• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Launching main app from share extension.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Launching main app from share extension.


  • Subject: Launching main app from share extension.
  • From: Ankit Agrawal <email@hidden>
  • Date: Thu, 21 Jun 2018 12:12:44 +0530

Hi Team,

I am having a use case where I have to launch the main app when user taps
on the file(s) from Photo Library or FileManager and choose to share with
my app.

I have implemented Share Extension to enable my extension to be visible in
share menu.

When the extension is selected I called the openUrl from extensionContext,
but it always returns NO for success and didn't launch app.

NSURL *url = [NSURL URLWithString:@"myapp://"];
[self.extensionContext openURL: url completionHandler:^(BOOL success) {
        NSLog(@"%@", success?@"Success":@"Failure");//This always returns
NO.
}];


I have seen various apps on app store is able to launch/open main container
app from share extension including iBooks.
Can you suggest me a way to open/launch main app from the share menu?

I was going through the stackoverflow and found one of the solution where
it will iterate to the responder and when the responder is UIApplication
will call openUrl it works for me but is it safe way? (for App Store
Submission).

NSURL *url = [NSURL URLWithString:@"myapp://"];
UIResponder *responder = self;//self is ShareViewController
while (responder) {
     if ([responder respondsToSelector:@selector(openUrl:)]) {
          [responder performSelector:@selector(openUrl:) withObject:url];
     }
     responder = [responder nextResponder];
}



Regards,
Ankit Agrawal
iOS Developer
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Scrolling differences when using Trackpad or Mouse-Wheel
  • Next by Date: Re: Scrolling differences when using Trackpad or Mouse-Wheel
  • Previous by thread: Re: Scrolling differences when using Trackpad or Mouse-Wheel
  • Next by thread: How to make my NSViewControllers participate in responder chain?
  • Index(es):
    • Date
    • Thread