问题
Here is the error when I try to login from my app.
MyApp[47747:907] Failed to log in Error Domain=com.facebook.sdk Code=2
"The operation couldn’t be completed. (com.facebook.sdk error 2.)"
UserInfo=0x1c5d3c50 {com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:SystemLoginCancelled, com.facebook.sdk:ErrorInnerErrorKey=Error Domain=com.apple.accounts Code=7
"The Facebook server could not fulfill this access request: Invalid application [My_App_Id]"
UserInfo=0x1c5cb630 {NSLocalizedDescription=The Facebook server could not fulfill this access request: Invalid application [My_App_Id]}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x1c584800, state: FBSessionStateClosedLoginFailed, loginHandler: 0x0, appID: 589037374454169, urlSchemeSuffix: , tokenCachingStrategy:<PFFacebookTokenCachingStrategy: 0x1d0818a0>, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>}
On another iPhone the authorization works without problems. I checked that on both devices, My App is enabled for Facebook native auth.
Any ideas?
回答1:
Ok, my mistake. I was trying with my friend's Facebook account and he was not identified as a developer on Facebook.
Once I disabled the Sandbox mode for my app, login worked without problems.
回答2:
Obviously, as said above, you could disable the sandbox mode for your app, or you could add your friend as a developer on Facebook @developer.facebook.com (if you need).
来源:https://stackoverflow.com/questions/16085249/invalid-application-id-with-facebook-ios-application