you can’t use self in block methods, use weakself reference to do so

13 Jun

__unsafe_unretained typeof(self) weakSelf = self;
[self.viewController setButton2Block:^(UIButton *button){
ViewController *obj_ViewController = [[ViewController alloc] initWithNibName:(IS_IPHONE_5)?@”ViewController_iPhone5″:@”ViewController” bundle:nil];
weakSelf.navigationController = [[UINavigationController alloc]
weakSelf.window.rootViewController = weakSelf.navigationController;
[weakSelf.window makeKeyAndVisible];

Leave a comment

Posted by on June 13, 2014 in Uncategorized


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: