问题描述
我知道当您将应用程序提交到应用程序商店时,您的应用程序中不允许有一些受限制的 API 或代码.
I know that there are some restricted api's or code that are not allowed to be in your app when you submit it to the app store.
你怎么知道它们是什么?有没有办法在提交之前检查您的应用以确保您没有使用过此类 API?
How do you know what they are? Is there a way to check your app before you submit it to ensure you have not used such api's?
在设计阶段避免这个问题可能比以后尝试修复它更好,所以我想知道 Xcode 中是否有任何工具或文档可以确定这一点.
It is probably better to avoid this problem at the design stage, than trying to fix it later, so I was wondering if there is any tool in Xcode, or document to determine this.
推荐答案
Apple 打算让您这样做的方式是使用 XCode 的验证功能.当您提交应用程序时,您进行构建是为了实现(或从 XCode 菜单存档).然后,您打开管理器以查看您刚刚创建的存档.此时,您可以按管理器中的验证按钮.这将执行验证,而无需实际提交应用程序.它会告诉您是否使用私有 API.根据您使用它们的方式,它可能会识别违规行为:
The way Apple intends for you to do this is to use XCode's Validation feature. When you're submitting an app, you build for achiving (or Archive from the XCode menu). Then, you open up Organizer to see the archive you just created. At this point, you can press the Validate button in Organizer. That will perform a validation, without actually submitting the app. It will tell you if you're using Private APIs. Depending on how you use them, it might identify what the violation is:
代码肯定可以通过多种方式来欺骗此验证步骤,并在审阅者查看捆绑包之前逃脱"使用私有 API.但是,据我所知,这些方法都是有意隐藏私有 API 使用的方法,听起来您是在尝试发现意外使用.
There's definitely ways that code can fool this validation step, and "get away" with using Private APIs until the reviewer looks at the bundle. But, as far as I know, those ways would all be intentional methods of hiding Private API usage, and it sounds like you're trying to discover accidental usage.
如果您未通过此验证测试,那么您可能需要使用 alan duncan 的回答中提到的 AppScanner 之类的工具.但是,为了完整起见,我想确保人们知道 XCode 中提供了此验证步骤,并且检查私有 API 使用情况是在您提交之前所做的事情之一(并且必须等待几天才能知道您做错了).此外,即使您不使用管理器中的验证按钮,而只是使用提交,该工具也会为您执行验证.唯一的区别是捆绑包是否真的上传到了 iTunes Connect.
If you fail this Validation test, then you might want to use something like AppScanner, mentioned in alan duncan's answer. But, for completeness, I wanted to make sure people knew that this Validation step is available in XCode, and checking for Private API usage is one of the things it's doing before you submit (and have to wait a few days to be told what you did wrong). Also, even if you don't use the Validate button in Organizer, but just use Submit, the tool is performing a Validation for you. The only difference is whether the bundle actually gets uploaded to iTunes Connect.
这篇关于如何检查您的 iOS 应用代码是否使用了应用商店不允许的 api?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!