简体   繁体   中英

Facebook facebook-ios-sdk and graph api is not working

I am using the official facebook ios sdk in my app (https://github.com/facebook/facebook-ios-sdk)

It was all working fine. I was able to log in, pull all my info from Facebook, post things on my wall. Do all those regular stuff that you do...

But since last night, it appears to be broken. When the login window appears and the user logs in, instead of getting the authkey and getting a callback. The login window directs users to facebook.com.

Did anyone else notice the problem? Is there any fix to it or we just assume that the graph API is broken right now and wait?

I assume Facebook were just having a problem. If you had it working & did not change the code then the issue is elsewhere?

In general it's a pain to get working so the following is a brief hint to anyone who is stuck.

Having spent 2 days getting this working I recommend (assuming you have registered an app with Facebook) :

First get the demo app working .

This ensures you have your app ID and worked out how to add the URL stuff into the plist. This is explained in the docs so should not give you much trouble.

Once all the options in the demo app work (login, post, upload a sample photo) you can think about your own app.

Many things are different but you still need to have the AppDelegate method for the URL stuff. Also this method does not work as is assuming your app is using more than one view controller.

I went for the approach of setting up facebook in the app delegate eg:

Facebook *facebook

and in the actual facebook routine referencing that appDelegate's facebook object eg:

appDelegate.facebook

This approach is the subject of quite a few posts on the interweb so you should be able to google it.

I can log on, get info, post & upload photos.

I'm having the same issue, i downloaded the "official example" from gitHub, and wehn compiled it does she@. After i login, it open safari and redirects to http://www.facebook.com/connect/uiserver.php , and the app stalls. Well that's not the way to do it, Facebook. They are obsoleting the old rest api, meanwhile the "new" graph things not working. Im currently using graph API with my own calls to graph.

Check if you have done the following

1.URL scheme corresponding to your Facebook application ID is set. Your URL Schemes must contain item looking like "fb1234567890"

2.AppDelegate's method must be implemented:

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url

it is described in https://github.com/facebook/facebook-ios-sdk "Authentication and Authorization". Read also "Single Sign-On".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM