Meine iOS App nutzt Facebook zum Einloggen, aber mein Entwicklerteam hat kürzlich beschlossen, alle unsere Apps in einer universellen Facebook App mit einer gemeinsamen APP ID zu konsolidieren. Also ging ich in mein Projekt und versuchte, meine FacebookAppID und URL-Typen in die richtige APP ID zu ändern, aber wenn ich die App starte und auf den Login-Button klicke, wird ich in meine alte App auf Facebook eingeloggt. Ich habe absolut keine Ahnung, warum dies geschieht, aber hier ist das, was ich in meiner AppDelegate Datei:Facebook Einloggen in falsche App auf iOS
/*
Callback for session changes
*/
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState) state
error:(NSError *)error
{
switch (state) {
case FBSessionStateOpen:
if (!error) {
// We have a valid session
NSLog(@"User session found");
}
break;
case FBSessionStateClosed:
case FBSessionStateClosedLoginFailed:
[FBSession.activeSession closeAndClearTokenInformation];
break;
default:
break;
}
[[NSNotificationCenter defaultCenter]
postNotificationName:FBSessionStateChangedNotification
object:session];
if (error) {
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Error"
message:error.localizedDescription
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}
/*
* Opens a Facebook session and optionally shows the login UX.
*/
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"email",
@"user_games_activity",
@"user_location",
@"user_likes",
@"user_birthday",
nil];
return [FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:allowLoginUI
completionHandler:^(FBSession *session,
FBSessionState state,
NSError *error) {
[self sessionStateChanged:session
state:state
error:error];
}];
}
/*
* If we have a valid session at the time of openURL call, we handle
* Facebook transitions by passing the url argument to handleOpenURL
*/
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// attempt to extract a token from the url
return [FBSession.activeSession handleOpenURL:url];
}
/*
*Logout
*
*/
- (void) closeSession {
[FBSession.activeSession closeAndClearTokenInformation];
}
angezeigt wird. Es stellte sich heraus, dass ich mehr als ein URL-Schema hatte, das Problem behoben! Vielen Dank. –
Ich habe festgestellt, dass die beiden Apps, die ich habe, das gleiche Facebook-URL-Schema haben und ich das URL-Schema geändert habe, aber nichts passiert ist, noch eine andere Anwendung öffnen. –