Я пытаюсь войти в свое приложение с помощью Facebook, но каждый раз, когда я пытаюсь войти в систему, он говорит: «Операция не может быть завершена. (ошибка com.facebook.edk2)
Код, который я написал, выглядит следующим образом:
- (void)openSession
{
NSArray *permissions = [NSArray arrayWithObjects:@"email", nil];
[FBSession openActiveSessionWithPermissions:permissions
allowLoginUI:YES
completionHandler:
^(FBSession *session,
FBSessionState state, NSError *error) {
[self sessionStateChanged:session state:state error:error];
}];
permissions = nil;
}
И код sessionStateChanged:
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState) state
error:(NSError *)error {
switch (state) {
case FBSessionStateOpen: {
// Pull information on user to send to server
if (FBSession.activeSession.isOpen) {
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user,
NSError *error) {
if (!error) {
//login api call
NSLog(@"(UserID, Token) :: (%@, %@)\n", session.accessToken, user.id);
}
}];
}
}
break;
case FBSessionStateClosed:
case FBSessionStateClosedLoginFailed:
// Once the user has logged in, we want them to
// be looking at the root view.
[self.navigationController popToRootViewControllerAnimated:NO];
[FBSession.activeSession closeAndClearTokenInformation];
break;
default:
break;
}
if (error) {
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Error"
message:error.localizedDescription
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}
Пожалуйста, отформатируйте код, я пробовал, но не могу понять правильное форматирование