Reputation: 31
Since you can only go the normal route for launching a containing app from a Today extension, and not a Custom Keyboard, I've been trying to do the hacky version of launching a UIWebView and launching the containing app through its URL scheme. Mostly been getting help from this post: launch containing app from iOS8 Custom Keyboard, but I'm not allowed to comment on answers since I'm new to stack overflow.
Anyways, doing it now, the UIWebView is popping up but is just showing a blank white square and not launching the URL scheme. Already tried accessing the URL scheme from Safari, and I know that launches the app, so not sure why its not doing anything. Code I have now in the method following when the right key is pushed is:
let urlkey = NSURL(string: "MYAPP://")
let webAppView = UIWebView(frame: CGRectMake(0, 0, 100, 100))
let request = NSURLRequest(URL: urlkey!)
webAppView.loadRequest(request)
self.view.addSubview(webAppView)
Any ideas for why nothing in the view is loading, or other ways to go about launching a containing app from a custom keyboard appreciated. Using XCode 6.3 and Swift.
Upvotes: 2
Views: 778
Reputation: 225
It is not possible to launch another app through keyboard-extension.
Other extensions like today-widget-extension can use like below.
NSURL *pjURL = [NSURL URLWithString:@"hostingapp://home"];
[self.extensionContext openURL:pjURL completionHandler:nil];
//https://stackoverflow.com/questions/24019820/today-app-extension-widget-tap-to-open-containing-app
but, nothing happens in the keyboard-extension.
//I guess...
If you get success to implement launching app in the keyboard, the keyboard will not be accepted by Apple.
openURL not work in Action Extension
I found some people are trying that, so check this.
Some said their app accepted by apple.(I don't know it's true)
Upvotes: 1