2012-03-23 10 views
0


私は奇妙な問題に直面しています。
正しいユーザー名とパスワードを入力した後。ログインボタンを2回(2秒間隔で)押すとポップアップが消えます。 FBボタンをもう一度タップすると、すでに共有画面でログインしています。Facebookポップアップ問題 - iOS

私はそれを1回だけ押しても問題ありません。

予想: ログインに成功すると、ポップアップの共有画面に移動します。

ユーザー名とパスワードを入力しても初めての共有が問題になることがあります。

10回のうちに9回働いていますが、フレッシュインストール後にFB壁に投稿されないことがあります。

どのような提案も本当にありがとうございます。

+0

いくつかのコードを投稿できますか? –

+0

私はあなたの問題を一度経験しました。コードを入力しても、私はあなたを助けることができます。 –

答えて

0

このコードを試してみてください

-(void)buttonPressed:(id)sender{ 
facebook = [[Facebook alloc] initWithAppId:@"YOUR_APP_ID" andDelegate:self]; 

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
     if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) { 
      facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"]; 
      facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"]; 
     } 
if (![facebook isSessionValid]) { 
    [facebook authorize:nil]; 
}else{ 
[self postWall]; 
} 
// Pre 4.2 support 
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { 
    return [facebook handleOpenURL:url]; 
} 
- (void)fbDidLogin { 
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
    [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"]; 
    [defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"]; 
    [defaults synchronize]; 
    [self postWall]; 
} 
-(void)postWall{ 

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
            @"https://developers.facebook.com/docs/reference/dialogs/",@"link", 
            @"http://fbrell.com/f8.jpg",@"picture", 
            @"Facebook Dialogs",@"name", 
            @"Reference Documentation",@"caption", 
            @"Using Dialogs to interact with users.",@"description", 
            @"Facebook Dialogs are so easy!",@"message", 
            nil]; 

    [[self facebook] dialog:@"feed" andParams:params andDelegate:self]; 

} 

アプリIDを追加することを忘れないでください。