How to call a method within fbDialogNotLogin?
I'm using Facebook SDK in my app, but need help with what happens when the login process is cancelled. I tried referencing another controller, but it crashes and I get an error of Instance variable 'textview_facebook' accessed in a class method
.
It looks like I cannot make graphical changes inside this kind of method... how can I get around this?
Any advice? Thanks in advance!
Facebook.m
- (void)fbDialogNotLogin:(BOOL)cancelled {
if ([self.sessionDelegate respondsToSelector:@selector(fbDidNotLogin:)]) {
[_sessionDelegate fbDidNotLogin:cancelled];
NS开发者_运维技巧Log(@"Facebook Cancelled!!!");
[MapViewController stuffIsCancelled];
}
}
MapViewController.m
+(void)stuffIsCancelled {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4];
textview_facebook.alpha = 0;
[UIView commitAnimations];
}
Because you are in a class method you cannot access the instance properties, you only have access to static variables.
Depending on your project structure you can:
- Set the session delegate to be the
MapViewController
assuming that you call the login from it, implement thefbDidNotLogin
method and move the animations stuff in it. - Make the
MapViewController
a singleton and make thestuffIsCanceled
an object method. - Make the
textview_facebook
static
精彩评论