iOS 8 Today Widget and locked device

390 views Asked by At

Sorry, my english is bad!

I developed a today widget. I need to launch Maps App (for example) from the widget and do not work when the device is locked. How to detect a locked device and launch the unlock screen in this situation?

Regards,

1

There are 1 answers

0
Runar Ovesen Hjerpbakk On

Instead of using

UIApplication.SharedApplication.OpenUrl(new NSUrl("myapp://foo"));

Use

ExtensionContext.OpenUrl(new NSUrl("myapp://foo"), null);

The code is in C# using Xamarin.iOS, but the ObjectiveC-code is equivalent:

NSURL *url = [NSURL URLWithString:@"myapp://foo"];
[self.extensionContext openURL:url completionHandler:nil];