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