Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios SLComposeViewController InitWithService类型无法获取扩展错误_Ios_Objective C_Xcode_Facebook_Twitter - Fatal编程技术网

Ios SLComposeViewController InitWithService类型无法获取扩展错误

Ios SLComposeViewController InitWithService类型无法获取扩展错误,ios,objective-c,xcode,facebook,twitter,Ios,Objective C,Xcode,Facebook,Twitter,我正在我的一个应用程序中使用Facebook和Twitter共享。测试时,我突然发现以下错误。我检查了我的代码,我觉得没问题 2017-04-29 14:41:19.727248 iCamTranslator[1140:322770] [core] SLComposeViewController initWithServiceType failed to get extension for identifier com.apple.share.Facebook.post 2017-04-29 1

我正在我的一个应用程序中使用Facebook和Twitter共享。测试时,我突然发现以下错误。我检查了我的代码,我觉得没问题

2017-04-29 14:41:19.727248 iCamTranslator[1140:322770] [core] SLComposeViewController initWithServiceType failed to get extension for identifier com.apple.share.Facebook.post
2017-04-29 14:41:19.727642 iCamTranslator[1140:322770] [core] SLComposeViewController dealloc <SLComposeViewController: 0x102992050>
2017-04-29 14:41:19.750499 iCamTranslator[1140:322770] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target <AboutViewController: 0x102986900>.'

非常感谢您的帮助

这个愚蠢的错误是因为我没有在我的设备上更新我的Facebook应用程序。更新后,一切正常。对不起打扰你们了

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {

    SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
    SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
        if (result == SLComposeViewControllerResultCancelled)
        {
            NSLog(@"Cancelled");
        }
        else
        {
            NSLog(@"Done");
        }
        [controller dismissViewControllerAnimated:YES completion:Nil];
    };

    controller.completionHandler =myBlock;
    [controller setInitialText:@"iCamTranslator is a great translation app."];
    [controller addURL:[NSURL URLWithString:@"https://itunes.apple.com/us/app/icamtranslator/id955853183?mt=8"]];
    [controller addImage:[UIImage imageNamed:@"logo-2.png"]];

    [self presentViewController:controller animated:YES completion:Nil];

    }