1

この例を使用して、FaceBook SDK 3.0 を実装しました。唯一の違いは、ナビゲーション コントローラーを使用して Facebook Nib をポップアップさせたことです。

シミュレーターは、下のコードの実行中に sigabrt を取得します。コードなどの間違いを見つけられる人はいますか?

if (alertView.tag==200) { // 投稿ステータス

        [FBRequestConnection startForPostStatusUpdate:myStatus.text completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
            if (!error) {
                UIAlertView *tmp = [[UIAlertView alloc] 
                                    initWithTitle:@"Success" 
                                    message:@"Status Posted"
                                    delegate:self 
                                    cancelButtonTitle:nil
                                    otherButtonTitles:@"Ok", nil];

                [tmp show];
                [tmp release];
            } else {
                UIAlertView *tmp = [[UIAlertView alloc] 
                                    initWithTitle:@"Error" 
                                    message:@"Some error happened"
                                    delegate:self 
                                    cancelButtonTitle:nil
                                    otherButtonTitles:@"Ok", nil];

                [tmp show];
                [tmp release];
            }
        }];
    }

これはメソッド全体です:` -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {

if (buttonIndex==1) { // yes answer
    if (alertView.tag==100) {
        // then upload
        [self controlStatusUsable:NO];
        [FBRequestConnection startForUploadPhoto:myImg.image 
                               completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                                   if (!error) {
                                       UIAlertView *tmp = [[UIAlertView alloc] 
                                                           initWithTitle:@"Success" 
                                                           message:@"Photo Uploaded"
                                                           delegate:self 
                                                           cancelButtonTitle:nil
                                                           otherButtonTitles:@"Ok", nil];

                                       [tmp show];
                                       [tmp release];
                                   } else {
                                       UIAlertView *tmp = [[UIAlertView alloc] 
                                                           initWithTitle:@"Error" 
                                                           message:@"Some error happened"
                                                           delegate:self 
                                                           cancelButtonTitle:nil
                                                           otherButtonTitles:@"Ok", nil];

                                       [tmp show];
                                       [tmp release];
                                   }

                                   [self controlStatusUsable:YES];
                               }];

    }

    if (alertView.tag==200) {
        // the post status

        [FBRequestConnection startForPostStatusUpdate:myStatus.text completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
            if (!error) {
                UIAlertView *tmp = [[UIAlertView alloc] 
                                    initWithTitle:@"Success" 
                                    message:@"Status Posted"
                                    delegate:self 
                                    cancelButtonTitle:nil
                                    otherButtonTitles:@"Ok", nil];

                [tmp show];
                [tmp release];
            } else {
                UIAlertView *tmp = [[UIAlertView alloc] 
                                    initWithTitle:@"Error" 
                                    message:@"Some error happened"
                                    delegate:self 
                                    cancelButtonTitle:nil
                                    otherButtonTitles:@"Ok", nil];

                [tmp show];
                [tmp release];
            }
        }];
    }

}

}`

4

0 に答える 0