应用审核被拒的经历不少,但是因为 non-public APIs
而被拒还是第一次, 过程中也没少折腾, 所以记录一下, 帮助一下遇到同样问题的朋友, 也算做个笔记.
Apple 邮件内容
Guideline 2.5.1 - Performance - Software Requirements
Your app uses or references the following non-public APIs:
PrivateFrameworks/AdSupport.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.
正文
关于邮件中指出的 PrivateFrameworks/AdSupport.framework()
, 首先可以肯定的是在我自己的代码中肯定是没有使用过的(如果自己使用过的就自己另行处理). 因此只能检查一下是否引入的第三方静态库中是否调用了Apple禁止调用的一些 API.
利用命令检查 Mach-O
文件中是否包含 AdSupport
相关的字符(如果是其他提示可以换成相应的字符串).
检查单个文件是否包含目标字符串, 使用如下命令来查看:
此处检查了 .ipa
包内我们应用的 Mach-O
文件.
1
$ strings -a filePath | grep AdSupport
执行结果:
1
2
3
$ strings -a ~/Desktop/JiTongBao | grep AdSupport
/System/Library/PrivateFrameworks/AdSupport.framework/AdSupport
/System/Library/PrivateFrameworks/AdSupport.framework/AdSupport
由结果来看项目中确是包含了 AdSupport
相关的东西, 至于是哪里包含了 AdSupport
, 还需要进一步检查.
利用 Shell 检查工程下所有目录下的文件
如果一个文件一个文件来检查将会非常耗时, 并且都是重复工作, 所以直接用脚本来检查是最好的选择.
利用如下 ChekString.sh
来检查指定目录下的所有文件是否包含了目标字符.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# ChekString.sh
#
# Created by ZHK on 2018/6/13.
# Copyright © 2018年 ZHK. All rights reserved.
shpath=$(cd `dirname $0`; pwd)
function getdir() {
for element in `ls $1`
do
dir_or_file=$1"/"$element
if [ -d $dir_or_file ]; then
getdir $dir_or_file
else
// 检查每一个文件是否包含 `AdSupport`
res=`strings -a $dir_or_file | grep AdSupport`
if [ "$res" ]; then
echo "\033[31m $dir_or_file \033[0m" // 输出文件路径为红色字体
echo "\033[33m $res \033[0m" // 输出匹配到的字符串黄色字体
echo ''
fi
fi
done
}
getdir $shpath
使用方法:
直接把 ChekString.sh
放到需要检查的工程根目录下, 然后使用命令:
1
2
3
4
$ sh `shell 文件的路径`
// 或者
$ cd `PROJECT_DIR`
$ sh ChekString.sh
工程目录下所有文件检查结果如下:
由此可以看出, 在如下文件中包含了 AdSupport
相关的字符.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
`/Users/tianchaojiang/Desktop/ProjectDir/ChekString.sh`
res=`strings -a $dir_or_file | grep AdSupport`
`/Users/tianchaojiang/Desktop/ProjectDir/Vender/Rong360/Framework/Fabric.framework`/uploadDSYM
System/Library/Frameworks/AdSupport.framework
`/Users/tianchaojiang/Desktop/ProjectDir/Vender/Rong360/uploadDSYM`
System/Library/Frameworks/AdSupport.framework
`/Users/tianchaojiang/Desktop/ProjectDir/Vender/ZhimaCredit/ZMDependUponSDK.framework/Versions/A/ZMDependUponSDK`
System/Library/PrivateFrameworks/AdSupport.framework/AdSupport
`/Users/tianchaojiang/Desktop/ProjectDir/Vender/ZhimaCredit/ZMDependUponSDK.framework/Versions/Current/ZMDependUponSDK`
System/Library/PrivateFrameworks/AdSupport.framework/AdSupport
`/Users/tianchaojiang/Desktop/ProjectDir/Vender/ZhimaCredit/ZMDependUponSDK.framework/ZMDependUponSDK`
System/Library/PrivateFrameworks/AdSupport.framework/AdSupport
解决方法
- 最简单的方法就是直接把相关的文件直接删除.
- 引入进来的静态库或者一些类文件被引入进来肯定都是要使用的. 那就只能通过提交应用时候勾选使用了IDFA, 并且根据情况来勾选对应的选项.
- 但是现在我的情况是引入的相关库的功能是必须的 (并且官方略坑, 并不提供 NO-IDFA 版本的 SDK), 并且也设置了 IDFA 相关的选项依旧审核通过不了, 并且沟通也没有结果的. 最后只好加了广告 SDK, 做了个广告, 上线后再隐藏掉广告. 解决办法相当的不优雅.
如果你有什么更好的方法, 欢迎补充~