Search code examples
iosios8ios8-today-widgettoday-extension

Today widget openurl with parameter


I have a Today Widget for my app, it open the containing app while user tap today widget.

NSURL *url = [NSURL URLWithString:@"MYAPPNAME://" ];

[self.extensionContext openURL:url completionHandler:nil];

This code works as expected. But now I want to send the some data as a parameter with this. So I can open the corresponding view controller use of this parameter in containing app.

I searched in Apple API Documentation and stackoverflow also, but I cant find suitable answer.

Please give me the suggestion for sending data to containing app using openURL.


Solution

  • It is working. I add the data like this @"MYAPPNAME://Data1&Data2". What is the problem at first, i write the above line like this @"MYAPPNAME://Data1 & Data2". So whitespace is the problem. After trimming the whitespace it works. Thanks.