When I tried facebook loing using iphone app, I got below error.
The Facebook server could not fulfill this access request: The proxied app cannot request publish permissions without having being installed.
How can I solve this problem?
Here is my code.
(IBAction)btnLogin_Action:(id)sender
{
if (FBSession.activeSession.state == FBSessionStateOpen
|| FBSession.activeSession.state == FBSessionStateOpenTokenExtended) {
[FBSession.activeSession closeAndClearTokenInformation];
}
else
{
[FBSession openActiveSessionWithReadPermissions:@[@"public_profile",@"user_birthday", @"email"]
allowLoginUI:YES
completionHandler:
^(FBSession *session, FBSessionState state, NSError *error) {
[self sessionStateChanged:session state:state error:error];
}];
}
}
(void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError *)error
{
if (!error && state == FBSessionStateOpen){
[self userLoggedIn];
return;
}
if (error)
{
NSString *alertText, *alertTitle;
if ([FBErrorUtility shouldNotifyUserForError:error] == YES)
{
alertTitle = @"Something went wrong";
alertText = [FBErrorUtility userMessageForError:error];
[self showMessage:alertText withTitle:alertTitle];
}
else
{
if ([FBErrorUtility errorCategoryForError:error] == FBErrorCategoryUserCancelled)
{
}
else if ([FBErrorUtility errorCategoryForError:error] == FBErrorCategoryAuthenticationReopenSession)
{
alertTitle = @"Session Error";
alertText = @"Your current session is no longer valid. Please log in again.";
[self showMessage:alertText withTitle:alertTitle];
}
else
{
NSDictionary *errorInformation = [[[error.userInfo objectForKey:@"com.facebook.sdk:ParsedJSONResponseKey"] objectForKey:@"body"] objectForKey:@"error"];
alertTitle = @"Something went wrong";
alertText = [NSString stringWithFormat:@"Please retry. \n\n If the problem persists contact us and mention this error code: %@", [errorInformation objectForKey:@"message"]];
[self showMessage:alertText withTitle:alertTitle];
}
}
[FBSession.activeSession closeAndClearTokenInformation];
}
}
From my experience, to solve this problem, go through Facebook's iOS SDK setup and make sure you have everything they tell you, including Bundle Identifier, Facebook app ID, and more. Also make sure that your app has the Facebook SDK frameworks and dependency frameworks bundled.
If you do this correctly, your app should work.
Good luck.
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.