I have the following method, which basically tries to get the user profile picture from facebook/twitter. The issue is that the result will be returned in a delegate, so therefore profilePicture results is obtained in the delegate called by these two methods. How do I deal with this?
- (NSString *) profilePicture
{
NSString * result;
if (facebook.isSessionValid){
[facebook requestWithGraphPath:@"me/picture"
andParams:nil
andHttpMethod:@"GET"
andDelegate:self];
} else if ([_twitter isAuthorized]){
[_twitter getUserInformationFor:[_twitter username]];
}
return result;
}
You are setting the delegate to
self. So you need to implement protocol methods that the facebook class specifies in this class.In Facebook API, the protocol is named
FBRequestDelegateand the method you need to implement isrequest:didLoad:Example: taken from this page