IOS Facebook singleton and get profile picture -


i trying profile picture uiviewcontroller.

my facebook in singleton class. uiviewcontroller [[myfacebook shared requestwithgraphpath:@"me/picture" anddelegate:self];
doesn't work if need login or app fire first time. because authorize being called , didlogin being called.

this line not hit. - (void)request:(fbrequest *)request didload:(id)result {

how go around these scenario 1.singleton facebook instance class, 2.calling uiviewcontroller 3. need login.

i suggest creating protocol called facebooksingletondelegate

@class facebooksingleton;   @protocol facebooksingletondelegate <nsobject>  - (void) facebooksingletondidlogin:(facebooksingleton *) facebooksingleton;  - (void) facebooksingletondidnotlogin:(facebooksingleton *) facebooksingleton;  - (void) facebooksingletondidlogout:(facebooksingleton *) facebooksingleton;  - (void) facebooksingleton:(facebooksingleton *)facebooksingleton             request:(fbrequest *) request             didload:(id)result;   @end 

then create property in facebooksingleton.h

@property (nonatomic, strong) id<facebooksingletondelegate> delegate; 

then have view controller conform protocol -

@interface myviewcontroller<facebooksingletondelegate> 

then, set delegate in view controller, ex -

myviewcontroller.delegate = self; 

then, trigger delegate method facebooksingleton implementation (facebooksingleton.m) -

- (void)request:(fbrequest *)request didload:(id)result  {   [self.delegate facebooksingleton:self request:request didload:result];  } 

then, can implement following method inside view controller -

- (void) facebooksingleton:(facebooksingleton *)facebooksingleton             request:(fbrequest *) request             didload:(id)result {  // view controller receive event in here } 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -