Facebook iOS SDK "Something went wrong" at login possible diagnostic
I think I've discovered why the iOS Facebook SDK shows something went wrong when you login to it.
I rarely get this problem, and the app I'm developing is being tested by some other people and they are always getting this error, so I started to think what my account had different to theirs and I found that I have a security setting meaning I need to enter the device name that I'm using when I log into my account from the device / simulator.
That view appears after I tap login, and this is where other people are getting an error, so I used a friends account to log in and sure enough, he had the problem and 开发者_开发百科his security settings ignore saving new devices.
So I'm wondering, I think the Facebook SDK is trying to prompt the user to save the device to their account, and for the users who have this security feature disabled, the SDK runs into problems.
Also it's interesting to note that this doesn't stop the user being logged in, because when I try to share with Facebook just after, I am taken to my feed dialog view which I wanted from the start.
Any thoughts on this ?
Here's what I came up with as a workaround, though fair warning it isn't a proper solution. I don't really like it as it's very hacky, but it works for now.
Before showing a the stream dialog, I check to see if the user is logged in. If not, I show the login dialog and then trigger the stream dialog in the DidLogin callback. Basically I'm avoiding the automatic Login to Post Dialog transition.
In my case wrong permissions were the reason. Such a stupid missing. Maybe it will help anybody in the future..
Follow the official guide and make sure you have done all the steps.
- Install the library
- Add the Facebook-related settings to the info.plist
- Add code to App Delegate
- Add code to your login controller
In my case, I have the permission string wrong. I put "publicProfile" instead of "public_profile". The most common cause is having wrong FacebookAppID, Bundle Identifier, or permission.
精彩评论