- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Default block not being called when switching back to original variation
Default block not being called when switching back to original variation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
I've got the following block :
OptimizelyCodeBlocksKeyWithBlockNames(optzl_drawButtons,@"anchorButtonsToExplanationLabel",@"yearlyFirst",@"anchorButtonsToExplanationLabelAndYearlyFirst");
That I register it like this :
[Optimizely registerCallbackForCodeBlockWithKey:optzl_drawButtons callback:^{ [self remakeConstraints]; }];
And call it like this :
- (void)remakeConstraints { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"REMAKING CONSTRAINTS TRIGGERED" message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; [Optimizely codeBlocksWithKey:optzl_drawButtons blockOne:^{ self.isAnchoringToExplanationLabel = YES; self.isYearlyFirst = NO; } blockTwo:^{ self.isAnchoringToExplanationLabel = NO; self.isYearlyFirst = YES; } blockThree:^{ self.isYearlyFirst = YES; self.isAnchoringToExplanationLabel = YES; }defaultBlock:^{ self.isYearlyFirst = NO; self.isAnchoringToExplanationLabel = NO; }];
I also call it on loadView (tried to change it to viewDidLoad but didn't work either) :
- (void)loadView { [super loadView]; [self remakeConstraints];
The intent behind it is to change the positioning of certain UI elements.
Creating a new variation and changing it from Default to other blocks works well.
My issue is that when I switch back to the Original variation, the Default block doesn't get triggered.
Re: Default block not being called when switching back to original variation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
@joaosbt Thanks for bringing this to our attention. I was able to reproduce this bug using your instructions and I have filed a bug report. The registerCallbackForCodeBlockWithKey function is only called when the app is in Edit mode, connected to the Editor, and a Code Block branch is selected that is not the default. This callback should fire even when the branch is default.
Until we fix this bug, I would recommend testing these code blocks in Preview mode rather than relying on the callback. This will not affect the ability to fire the default code block in production — experiments will still be able to run.
Ted