问题描述
我正在使用此处提供的解决方案从共享扩展中打开我的内容.尽管它很脆弱,但它似乎没有使用任何私有 API 方式来做到这一点.
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.
如果我使用我的应用程序,Apple 会拒绝它吗?任何人都有一个已批准的应用程序,可以打开包含来自共享扩展的应用程序?如果是这样,正确的做法是什么?
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?
感谢任何指针.
推荐答案
虽然有很多关于如何从共享扩展打开包含/父应用程序的问题,但没有人真正谈论提议的解决方案/hack 是否会被苹果或不详细.
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.
一个这样的例子是
建议共享扩展不应打开容器应用.
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
线程问题,苹果是否允许使用openURL
遍历UIResponder链打开父应用程序的hack?(与您发布的链接中显示的想法完全相同).
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
+[UIApplication sharedApplication] 和 -openURL: 不可用于扩展的事实应该是这里的一个重要提示.忽略该限制并通过 Objective-C 运行时查找符号不是一个好主意.
显然,thread 建议(暗示,没有明确说明苹果将拒绝该应用程序的事实)尽管苹果现在会批准该应用程序,但这只是一个临时解决方案.
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.
现在终于得出了答案:
答案:
最近在@Bangalore 举办的苹果活动中,我有机会见到了@apple 扩展团队的开发人员.我告诉他们我一直在使用上面提到的 hack 从共享扩展中打开应用程序,苹果会允许吗?
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?
他的回答:
`UIResponder`
不是私有实体,因此使用 UIResponder
不会违反私有 API 使用条件,因此使用上述 hack 的应用程序仍然被苹果批准.但事实上,您的代码通过 UIResponder 链解析以触发 openURL
成本非常高,并且不建议/首选.因为 Apple 似乎意识到开发人员使用它,他们可能强> 将来开始拒绝该应用程序.(必须说,他不确定最后一点,苹果将来拒绝应用程序因此突出可能)
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)
他还碰巧提到使用 WebView
来打开开发人员很久以前也使用过的应用程序.哪个不再起作用.
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.
结论:
是的,您可以使用上述 hack 提交从扩展程序打开父应用程序的应用程序,但要完全意识到这只是一个临时解决方案,苹果希望您编写完全独立的共享扩展程序
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
针对当前 iOS 版本的 iOS11 回答了问题.答案可能会随着 iOS 的未来版本而失效
这篇关于如果我从共享扩展程序打开包含应用程序,Apple 会拒绝吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!