iOS版 - 整合Facebook的框架
在我的iOS应用程序,我成功地集成最新的Facebook的框架。
其工作正常,如果“脸谱”的应用程序是不是在我的iPhone。如果该应用程序不在我的iphone上,则在进行身份验证时,会打开浏览器并正确进行身份验证。
但是,如果Facebook应用程序在我的iphone上,在身份验证和返回到我的应用程序后,其崩溃与以下错误:
由于未捕获异常'NSInvalidArgumentException'终止应用程序,原因:' - [SBJsonParser errorTrace]:无法识别选择发送到实例0x2d9f60'iOS版 - 整合Facebook的框架
我已经看到Facebook提供的样品和我的应用程序中实现相同。有人能指出我可能会遇到什么问题吗?
这是一个位在黑暗中刺,但我想你可能会就SBJsonParser
:)
什么是可能发生的事情是你打电话errorTrace
的东西,你已经发布了一个实例调用方法errorTrace
早。通过触发的代码路径去当Facebook重新打开你的应用程序,并找到errorTrace
通话。在它之前设置一个断点并查看看看有什么不对。
它已经从FB框架。所以我不能放任何断点来追踪它。没有FB应用程序在我的iPhone上,它的工作正常。随着设备上的Facebook应用程序,它的崩溃。 – Satyam
同样的问题在这里 –
如果你只想在iOS版6.0共享的东西,所以你使用的社会和帐户框架,并使用下面的代码
-(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];
}];
}
我们不能使用相同的iOS5上... – Satyam
通过iPhone内部登录胜任的问题可能是你有在SBJson库的版本。看看这个类似的问题:http://facebook.stackoverflow.com/questions/12301617/application-crash-on-login-in-ios-facebook-sdk-3-0 – borisdiakur