ios - 一旦我从分享扩展分享到我的应用程序的链接,Safari 就会被卡住

标签 ios swift ios8-share-extension

我的应用程序实现了 Share 扩展。我可以从 Safari 共享任何指向我的应用程序的链接,一旦我点击 SLComposeServiceViewController 中的 POST 按钮,共享 View 消失,但 Safari 的屏幕被卡住。我需要强制关闭 Safari 才能再次使用它。

  • 这可能是什么原因?
  • 我怎样才能防止将来发生这种情况?

这就是我的 didSelectPost() 的样子:

override func didSelectPost() {
    AddToWishlistNetworkClient.sharedClient().createItemForWishlistIdentifier(selectedWishlist!.identifier, addressOrUrl: composePropertyUrlSheet.value, comment: contentText, completionBlock: nil)
}

最佳答案

一旦您在 didSelectPost() 中完成所有操作,completeRequestReturningItems: 方法必须被调用,以便宿主应用程序可以取消阻止它的用户界面。

AddToWishlistNetworkClient.sharedClient().createItemForWishlistIdentifier(selectedWishlist!.identifier, addressOrUrl: composePropertyUrlSheet.value, comment: contentText, completionBlock: { error in

    self.extensionContext?.completeRequestReturningItems([], completionHandler: nil)
})

关于ios - 一旦我从分享扩展分享到我的应用程序的链接,Safari 就会被卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35452354/

相关文章:

ios - 如何自定义不同图片和位置的 UIRefreshControl?

ios - 类型 'AnyObject' 不符合协议(protocol) 'sequenceType'

ios - 如何在 Xcode 中访问 Genstrings?

swift - 我可以在 Swift 中扩展 final 类吗?

iOS 证明文件可从共享扩展上传到 React Native

ios - 无法通过共享扩展打开/读取图像

ios - 所有 iPad 和 iPad Pro 的 View 之间的常规/常规间距?

ios - y 轴的文本表示

ios webcal 请求 - 完成回调?

ios - 如何将一个应用程序的内容共享到另一个应用程序