问题
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 .
回答1:
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
来源:https://stackoverflow.com/questions/47398034/will-apple-reject-if-i-open-containing-app-from-share-extension