So I have an app and a share extension. For the share extension I have just one simple controller that extends UIViewController
and not SLComposeServiceViewController
(I believe the default view is too complicated for what I am trying to do). What i'm trying to achieve inside the extension is to get some data from UserDefaults
, make some HTTP
requests and show an alert with the HTTP
response. The share extension should only be used inside a browser, but after I tap the extension the browser view freezes and after I dismiss the alert the browser is still frozen. How and where I should dismiss the alert or the parent view?
I'm new to this environment but I did some research and I believe this has something to do with the view hierarchy but I'm not sure, here is the controller:
class ShareViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
}
override func viewDidAppear(_ animated: Bool) {
let alert = UIAlertController(title: "Notification", message: "message", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}
It's a duplicate and I'm not sure if I should answer here as well. Sorry for not searching enough. For swift 3:
self.extensionContext!.completeRequest(returningItems: nil, completionHandler: nil)