大家好,我知道这个论点已经被分享了,当我尝试使用这段代码时,我的应用程序崩溃了:
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]){
SLComposeViewController *facebook = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeFacebook];
[facebook setInitialText:@"https://itunes.apple.com"];
[self presentViewController:facebook animated:YES completion:Nil];
[facebook setCompletionHandler:^(SLComposeViewControllerResult result) {
NSString *outPut = nil;
switch (result) {
case SLComposeViewControllerResultCancelled:
outPut =@"Action Cancelled";
break;
case SLComposeViewControllerResultDone:
outPut = @"Posted Successfully";
break;
default:
break;
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook" message:outPut delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil, nil];
[alert show];
}];
}
以下是我的崩溃报告:
2013-06-25 12:41:24.112 MyApp[11779:1cd03] -[AboutViewController Facebook:]: unrecognized selector sent to instance 0x9c649d0
2013-06-25 12:41:24.114 MyApp[11779:1cd03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AboutViewController Facebook:]: unrecognized selector sent to instance 0x9c649d0'
*** First throw call stack:
(0x1a67012 0x12d3e7e 0x1af24bd 0x1a56bbc 0x1a5694e 0x12e7705 0x21b2c0 0x21b258 0x2dc021 0x2dc57f 0x2db6e8 0x24acef 0x24af02 0x228d4a 0x21a698 0x2ba0df9 0x2ba0ad0 0x19dcbf5 0x19dc962 0x1a0dbb6 0x1a0cf44 0x1a0ce1b 0x2b9f7e3 0x2b9f668 0x217ffc 0x2afd 0x2a25)
libc++abi.dylib: terminate called throwing an exception
(lldb)
还引发了崩溃,它会自动将我带到显示此行的主页上
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
signal SIGBART
我还想说,我是编程新手,可能你们都会注意到对你们所有人的错误是简单的识别。如果你们中的一些人能与我分享你的知识并帮助我找到崩溃的解决方案,我将不胜感激。
提前致谢!