1

My app implements Share extension. I can share any link to my app from Safari, once I tap POST button within SLComposeServiceViewController share view disappear, but screen of Safari is frozen. I need to force close Safari to use it again.

  • What may be the reason of this?
  • How can I prevent from happen this in the future?

This is how my didSelectPost() looks like:

override func didSelectPost() {
    AddToWishlistNetworkClient.sharedClient().createItemForWishlistIdentifier(selectedWishlist!.identifier, addressOrUrl: composePropertyUrlSheet.value, comment: contentText, completionBlock: nil)
}
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358

2 Answers2

0

Once you do everything within didSelectPost() the completeRequestReturningItems: method MUST be called, so that the host app can un-block its UI.

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

    self.extensionContext?.completeRequestReturningItems([], completionHandler: nil)
})
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
0

As suggested by the previous answer, at the end of your didSelectPost() make sure to call

self.extensionContext?.completeRequest(returningItems: [], completionHandler:nil)

This will dismiss Safari.

lucius degeer
  • 403
  • 1
  • 6
  • 17