Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSExtensionContext openURL doesn't work

I'm trying to launch the container app from the extension. (An Action extension) The container app has a working URL scheme (example://) and I can validate this by navigating to that URL in Safari.

When I try to use the -[NSExtensionContext openURL:completionHandler:] to launch the container app, I get an unsuccessful callback and nothing happens.

The iOS 8 Beta 2 changes say that the openURL method should work now, but is this still a bug or am I doing something wrong?

like image 910
Mert Dümenci Avatar asked Jul 02 '14 18:07

Mert Dümenci


1 Answers

It worked for me in a Today Extension using this code:

NSExtensionContext *myExtension=[self extensionContext];
[myExtension openURL:[NSURL URLWithString:@"http://google.com"] completionHandler:nil];

However, it might not work in Action Extensions. From the documentation:

Each extension point determines whether to support this method, or under which conditions to support this method. In iOS 8.0, only the Today extension point supports this method.

like image 194
jk9357 Avatar answered Sep 27 '22 22:09

jk9357