share app extension

Is it allowed by apple during app review to directly open containing app with the use of openurl:urlscheme from share extension when user click on extension icon ??


I have created an share app extension of my main app....and now i want to share images from photos to my main application. I want to open my main containing app when user click on extension icon. I have subclass my extension controller from UIViewController and on viewDidLoad, I am getting images form NSExtensionItemProvider and than opening my main app by calling openurl:


detail func is below:


NSURL *destinationURL = [NSURL URLWithString:@"myapp://";

NSString *className = @"UIApplication";

if (NSClassFromString(className)) {

id object = [NSClassFromString(className) performSelector:@selector(sharedApplication)];

[object performSelector:@selector(openURL:) withObject:destinationURL];

}



Wll it be allowed by apple during itunes review ??

As apple also mentioned for extensions to have some kind of UI or to have some additional func in the host app....is it mandatory ???


just want to use my app extensions as a main app launcher..nothing else...will it be allowed ??

While I can speak for App Review, I can comment on this from a technical perspective…

The fact that

+[UIApplication sharedApplication]
, and hence
-openURL:
, is not available to extensions should be an important hint here. Ignoring that restriction and looking up the symbols via the Objective-C runtime is not a good idea.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
share app extension
 
 
Q