I have a sample code with a .h, a .m file and the two appDelegate files. I would like to add what the project does to my app. The first two files are a ViewController file, so I just need to drag it in, but the other two are AppDelegate, and I obviously can’t have two app delegate. But in the case of this sample app the app delegate is used as a proper viewcontroller, because in the .m file of the UIViewController file, there is this code:
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
Since the AppDelegate doesn’t use features like willBecomeActive…, how can I transform the file in a UIViewController file? What do I need to change in the code above to call the controller, instead of the Delegate (my AppDelegate will so remain untouched).
The code is here: https://github.com/fbsamples/ios-3.1-howtos/tree/master/SendRequestsHowTo …then open project: SendRequestsHowTo …it’s only 4 files
P.S. i think I have to create something like an app delegate, which is not an app delegate though.
As i can understand you want to move code from SendRequestsHowTo into your project. And you don’t want to use Facebook through your AppDelegate?
You can create new class (ex. FacebookManager). Then move code from SendRequestsHowTo’s AppDelegate to FacebookManager, and you can make it singleton.
Then you can access from ViewController:
and from AppDelegate to handleOpenURL:
Don’t forget to add The CFBundleURLTypes to Info.plist, it should look like this:
Facebook iOS Safari "Cannot Open Page Error" When Authenticating User with Single-Sign-On