私有Api检测

早段时间,因为上架问题被拒了,苹果反馈的原因是使用了私有api

Guideline 2.5.1 - Performance - Software Requirements


Your app uses or references the following non-public APIs:

GraphicsServices.framework

The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change. 

Continuing to use or conceal non-public APIs in future submissions of this app may result in the termination of your Apple Developer account, as well as removal of all associated apps from the App Store.

Next Steps

If you are using third-party libraries, please update to the most recent version of those libraries. If you do not have access to the libraries' source, you may be able to search the compiled binary using the "strings" or "otool" command line tools. The "strings" tool can output a list of the methods that the library calls and "otool -ov" will output the Objective-C class structures and their defined methods. These tools can help you narrow down where the problematic code resides. You could also use the "nm" tool to verify if any third-party libraries are calling these APIs.

Resources

For information on the "nm" tool, please review the "nm tool" Xcode manual page.

If there are no alternatives for providing the functionality your app requires, you can file an enhancement request.

私有api属于这个GraphicsServices.framework库中,然后我全局搜索后发现无法检测到这个库的存在,应该是私有库之类的。

在几经折腾,实在找不到后,联系苹果的技术支持反馈的是使用是下面这个私有api

[UIDevice supportsCapability:]

.a库里面我们是没法全局搜索到的,所以要用到终端全局搜索。
方法有几种,我在查找的时候基本能定位到使用私有api的第三方库的位置

1.cd 到工程的目录
调用全局搜索的命令 [ grep -r supportsCapability .  ] 或者  [ grep -r GraphicsServices .  ]看仔细后面有一点,定位到的是环信的SDK, ,很老的版本,很多很旧的东西,问题就出在这里。、,查到后,替换成最新的SDK就没问题了。
结果.png

再次匹配你私有api已经不存在了

2. 第二种方法的具体步骤:

   1、首先你有个可以提交审核的ipa,就是打包的第一个,不是测试的release。

   2、将ipa重命名为zip格式,解压。如果有两个文件夹Payload、Symbols,就OK。

   3、cd到Payload里面的app

   4、有两种方式可以检测打包文件是否包含字符串

            (1) strings - -a -arch armv7 "test" | grep canOpenUrl

            (2)strings - -a -arch armv7 "test" > test.txt

具体可以参考这文章:利用strings 检测iOS ipa包是否调用私有api
http://www.jianshu.com/p/9c16e0878086

两种方法我试过,都可以定位到具体的第三方库位置。


F1FA00A2-1961-4433-941E-7FB5843CE7FD.png
最后总结下思路
1.如果你是项目最近有新添加的第三方库,可以挨个去排查。
2.如果你是像我这样是旧的SDK产生的问题,无从下手,最快捷的方法是联系苹果技术支持,获取到具体的那个私有Api,再全局查找定位。

你可能感兴趣的:(私有Api检测)