Can we open safari link from the extension?

I tried to open a safari URL, but it doesn't seem to work.


[self.extensionContext openURL:[NSURL URLWithString:@"https://apple.com"] completionHandler:nil];


Is it not opening by design or is it a bug?

Replies

This thread here covers the topic:


https://stackoverflow.com/questions/24495362/launch-containing-app-from-ios8-custom-keyboard?answertab=votes#tab-top


There are workarounds to achieving this however in general its not recommended for extensions to launch url's.

Here is the earlier thread discussion on this topic - it was working in Xcode Beta 4 but not in Xcode 8 Beta 5 or Xcode 8 Beta 6:


https://forums.developer.apple.com/thread/54410