ios – 崩溃[SLComposeViewController initWithExtension:requestedServiceType:] _ block_invoke 84

我在SLComposeViewController上遇到了一些崩溃

Crashed: com.apple.extension.global-state-queue
0  libobjc.A.dylib                0x18167cbb4 objc_loadWeakRetained + 156
1  libobjc.A.dylib                0x18167cd64 objc_copyWeak + 24
2  Social                         0x1933abdbc __66-[SLComposeViewController initWithExtension:requestedServiceType:]_block_invoke + 84
3  Foundation                     0x182b30b04 __85-[NSExtension _completeRequestReturningItems:forExtensionContextWithUUID:completion:]_block_invoke + 108
4  libdispatch.dylib              0x181ad1088 _dispatch_call_block_and_release + 24
5  libdispatch.dylib              0x181ad1048 _dispatch_client_callout + 16
6  libdispatch.dylib              0x181adae48 _dispatch_queue_serial_drain$VARIANT$mp + 528
7  libdispatch.dylib              0x181adb7d8 _dispatch_queue_invoke$VARIANT$mp + 340
8  libdispatch.dylib              0x181adc200 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 400
9  libdispatch.dylib              0x181ae44a0 _dispatch_workloop_worker_thread$VARIANT$mp + 644
10 libsystem_pthread.dylib        0x181d76fe0 _pthread_wqthread + 932
11 libsystem_pthread.dylib        0x181d76c30 start_wqthread + 4

看起来像我的参考丢失了某种程度?任何的想法?

我没有做任何特别的事

- (void)presentTwitterShareWithURL:(NSURL *)url {

    if (url == nil) {
        return;
    }

    SLComposeViewController * cvc = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
    [cvc addURL:url];

    [cvc setCompletionHandler:^(SLComposeViewControllerResult result) {

        if (SLComposeViewControllerResultDone == result) {

            [[Analytics shared] trackWithCategory:@"Web" action:@"Tap" label:@"Share - Twitter"];

        }

    }];

    [self.navigationController presentViewController:cvc animated:YES completion:nil];

}

注意:它看起来像iOS11相关,因为我不记得之前有这个问题,除了iOS11也没有跟踪

最佳答案 在iOS 11中删除了SLServiceTypeTwitter.您需要使用Twitter自己的共享解决方案来实现此功能.

有关从当前解决方案迁移到TwitterKit的信息,请参阅此页面:https://dev.twitter.com/twitterkit/ios/migrate-social-framework

点赞