Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Today App Extension Widget Tap To Open Containing App

I've implemented a Today widget for my application +Quotes which displays the day's quote within the notification center with the help of these Apple Docs. What I'd like to accomplish is opening the Containing App, in this case +Quotes, when the user taps the +Quotes widget within their Today notification view, not entirely sure what to call this, as Calendar would if you tapped it in the Today view. I've tried overlaying a button over the label which would call -(void)openURL:(NSURL *)URL completionHandler:(void (^)(BOOL success))completionHandler upon it being tapped, then open the Custom URL Scheme I have declared to open the Containing App. The issue is it doesn't open the Containing App.

+Quotes Today App Extension Widget

-(IBAction)myButton:(id)sender {     NSURL *customURL = [NSURL URLWithString:@"PositiveQuotes://"];     [self openURL:customURL completionHandler:nil]; } 
like image 800
Daniel Storm Avatar asked Jun 03 '14 16:06

Daniel Storm


1 Answers

EDIT: Ok, just a little correction here. I got it working with placing a button over the label just like suggested above and the following code:

- (IBAction) goToApp: (id)sender {      NSURL *url = [NSURL URLWithString:@"floblog://"];     [self.extensionContext openURL:url completionHandler:nil];    } 

I linked it to a "Touch Up Inside" event. However, this also causes the app to launch when the user scrolls the Today view.

=======================================

I ran into the same issue. However, it seems that there is no solution for now since the release notes for the first beta of iOS 8 mention:

Known Issues: openURL does not work from an extension.

So I guess we will at least have to wait until beta 2.

like image 57
sunseeker Avatar answered Oct 02 '22 13:10

sunseeker