2

在我的 iOS 应用程序中,我成功集成了最新的 facebook 框架。
如果“facebook”应用程序不在我的 iPhone 上,它工作正常。如果该应用程序不在我的 iPhone 上,则在身份验证期间,它会打开浏览器并正确进行身份验证。
但是,如果 facebook 应用程序在我的 iphone 上,经过身份验证并返回我的应用程序时,它会因以下错误而崩溃:
由于未捕获的异常 'NSInvalidArgumentException' 导致应用程序终止,原因:'-[SBJsonParser errorTrace]:无法识别的选择器已发送到实例0x2d9f60'


我已经看到了 facebook 提供的示例,并在我的应用程序中实现了相同的示例。有人能指出我可能是什么问题吗?

4

2 回答 2

1

这有点像在黑暗中刺伤,但我认为您可能会在:)errorTrace的实例上调用该方法SBJsonParser

可能发生的情况是您正在调用errorTrace您提前发布的内容。浏览 facebook 重新打开您的应用时触发的代码路径并找到对errorTrace. 在它之前设置一个断点并环顾四周,看看有什么问题。

于 2012-09-03T14:53:17.720 回答
0

如果您只想在 iOS 6.0 中共享某些内容,那么您可以使用社交和帐户框架,并使用以下代码通过 iPhone 内部登录来完成这项工作

-(void)facebook_Share_in_IOS6.0{

    if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) //check if Facebook Account is linked
    {
        mySLComposerSheet = [[SLComposeViewController alloc] init]; //initiate the Social Controller
        mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; //Tell him with what social plattform to use it, e.g. facebook or twitter
        [mySLComposerSheet setInitialText:[NSString stringWithFormat:@"Test",mySLComposerSheet.serviceType]]; //the message you want to post
    //    [mySLComposerSheet addImage:yourimage]; 

        [self presentViewController:mySLComposerSheet animated:YES completion:nil];
    }else{
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Attention" message:@"First Set your facebook account. To post your answer to facebook" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
    }
    [mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {
        NSString *output;
        switch (result) {
            case SLComposeViewControllerResultCancelled:
                output = @"Action Cancelled";
                break;
            case SLComposeViewControllerResultDone:
                output = @"Post Successfull";
                break;
            default:
                break;
        } //check if everything worked properly. Give out a message on the state.
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook" message:output delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
    }];
}
于 2013-04-26T12:15:21.900 回答