Does FBRequestDelegate only work with AppDelegate?

I want to encapsulate all of my Facebook interactions in the classroom FacebookFacadein order to keep it clean and tidy. I have an instance of the Facebook iOS SDK class in mine FacebookFacade.

My problem is when I make a call to the Graph API inside the facade, for example:

    [self.facebook requestWithGraphPath:@"me" andDelegate:self]; 

The only method FBRequestDelegatethat is called: requestLoading:and nothing more. I tried to put similar code in other places, for example, in controllers and other models, and there, too, not all methods FBRequestDelegateare called, but only requestLoading:.

In fact, the only way to get other methods FBRequestDelegateto call is to put all my Facebook logic in AppDelegateand make mine AppDelegate FBRequestDelegate.

Why is this so? Am I missing something? I definitely do not want to use it AppDelegateas mine FBRequestDelegate, since I do not want to confuse the goal AppDelegate.

Thank.

+5
source share
3 answers

There was the same problem this afternoon. Finally decided: You should make your FBRequest from the main thread. Otherwise, the base NSURLConnect (in the facebook object) never starts.

+7
source

You can share your AppDelegate app with other controllers in your app.

I solved this problem by importing my AppDelgate (which creates and places the facebook object in it) in my interface, i.e.

#import "MyAppDelegate.h"

interface MyViewController: UIViewController <FBRequestDelegate, FBDialogDelegate, FBSessionDelegate>

, , , facebook , .

-(void) someFunction{
      MyAppDelgate *sharedAppDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate]
      [sharedAppDelegate.facebook dialog:@"feed" andDelegate:self]; 
}

,

+2

Make sure the source object is not freed, and facebook is running in the background. If so, when facebook goes to the delegate’s call and finds it zero or catches an error, it won’t call back.

+1
source

All Articles