3

I am using the solution provided here to open my containing from the share extension. It doesn't seem to use any private API way to do that despite that it is fragile.

Will Apple reject my App if I use it? Anybody has an approved app that open containing app from share extension? If so, what is the right way to do it?

Any pointer is appreciated .

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Vignesh
  • 10,205
  • 2
  • 35
  • 73
  • 1
    I'm voting to close this question as off-topic because it is an App Store approval question. – TylerP Nov 20 '17 at 18:55
  • @TylerTheCompiler I agree that it is not completely a programming question but the intention is to identify if there is a better way to do that than one suggested in the other posts. – Vignesh Nov 22 '17 at 19:12
  • I'm voting to close this question as off-topic because it is about publishing to an "app store" policies and procedures, rather than programming. See [Are developer-centric questions about application stores on topic?](//meta.stackoverflow.com/q/272165) – Makyen May 21 '18 at 23:55

1 Answers1

11

Though there are loads of questions on how to open containing/parent app from share extension, none actually talk whether the proposed solution/hack will be approved by apple or not in detail.

One such example is

Share Extension to open containing app

suggests that Share extensions are not supposed to open the container app.

While browsing some time back, I rather found a very interesting thread discussing the same topic here

https://forums.developer.apple.com/thread/27295

The thread questions, whether the hack of traversing UIResponder chain to open the parent app using openURL will be allowed by apple or not? (Precisely the same idea shown in your posted link as well).

Though the thread again does not provide clear answer as, whether it will be approved by apple or not but points out a very valid concern and warning

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.

Clearly, thread suggests (implicitly, by not clearly stating the fact that apple will reject the app with such hack) that though apple will approve the app for now, it will only be a temporary solution.

Now this finally leads to the answer:

Answer:

In a recent apple event held @ Bangalore, I had an opportunity to meet the developers of extension team @ apple. I told them that I have been using the above mentioned hack to open the app from share extension will this be allowed by apple?

His answer:

`UIResponder`

is not a private entity, hence usage of UIResponder will not violate the private API usage condition hence apps which are using the above hacks are still being approved by apple. But the fact that, your code parses through the UIResponder chain to trigger the openURL is very costly and not suggested/preferred.As Apple seems to be aware of developer using it, they might start rejecting the app in future. (Must say, he wasn't sure of the last point, apple rejecting app in future hence highlighting might)

He also happened to mention about usage of WebView to open the app which developers used quite sometime back as well. Which is no longer working.

Conclusion:

Yes you can submit the app which opens the parent app from extension using above hack but being completely aware of the fact that this is only a temporary solution and apple expects you to write completely independent share extensions

Question is Answered for current iOS version of iOS11. The answer might lose its validity with future releases of iOS

Sandeep Bhandari
  • 19,999
  • 5
  • 45
  • 78
  • @vignesh: My app with the same hack got approved 2 days ago (again, as it was already available in App Store with the hack) if its of any comfort :) – Sandeep Bhandari Nov 23 '17 at 07:02
  • My app share files from gmail inbox using share extension( with app group )through container app to host app. openURL not calling in iOS 13.1 and not opening main/host app from container app. i just click the container app and noting happen. Previous version works fine. Any findings ? – Jamshed Alam Feb 22 '20 at 02:35
  • have you found any solution @JamshedAlam – Nikki Jun 23 '22 at 10:06