App Store 审核 “私有API” Guideline 2.5.1 驳回解决方案

从4月18日 一个提交后的驳回,噩梦开始了:

驳回信息

在iOS项目中引入了私有API,审核被驳回

Guideline 2.5.1 - Performance - Software Requirements

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

com.apple.springboard.lockcomplete

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.

Guideline 2.5.1 - Performance - Software Requirements

Your app uses the "prefs:root=" non-public URL scheme, which is a private entity. 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

To resolve this issue, please revise your app to provide the associated functionality using public APIs or remove the functionality using the "prefs:root" or "App-Prefs:root" URL scheme.

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

私有API定义

先来科普下私有API的定义:

iPhone中的API除了公开的API:Published API外(或者叫文档中记录的API:Documented API),还有两类API:私有API:Private API和未公开的API:UnPublished API(或者叫文档中未记录的API:Undocumented API)。其中私有API是指放在PrivateFrameworks框架中的API,未公开的API是指虽然放在Frameworks框架中,但是却没有在苹果的官方文档中有使用说明、代码介绍等记录的API。后两种API是有区别的,按苹果的说法,未公开的API是还不够成熟,可能还会变动的API,等完全成型了后会变成公开的API,但是目前不对其提供承诺,就是系统版本升级后可能会失效。而私有API是苹果明确不能使用的API。虽然两者有所区别,但是在具体使用方法上是类似的。

关键点是这个私有API不是固定不变的,会随着版本的升级,原有的可以使用的API,在高版本后变成私有API而不能使用的。

定位查询方式

接下来直接放出解决方法吧,首先官方给了很多方式来定位哪些地方使用了私有API,网络上也有不少开源程序查询的,目前找到一个较为方便的方式:

1、网络上的方案

https://stackoverflow.com/questions/2842357/how-does-apple-know-you-are-using-private-api

2、开源程序的查询方式
https://www.jianshu.com/p/07779e293ca7

3、自己使用的方式

grep -r com.apple.springboard.lockcomplete ./

执行结果如下:

liuchangdeMacBook-Pro:Third liuchang$ grep -r com.apple.springboard.lockcomplete ./
Binary file .//HuaJiaoLiveStreaming/lib/QHIVideoSDK.framework/QHIVideoSDK matches
liuchangdeMacBook-Pro:Third liuchang$

检测到了三方库使用了该方法,就尝试联系三方来升级,解决该私有方法调用问题。

接下来就是接二连三的被拒,核心问题就是私有API,而且苹果反馈还非常强烈,如果继续使用会导致你的APP下架的可能。

我们制定的策略就是

1、能升级的三方、就尽量升级到最新版本,避免该问题带来被拒的可能

2、明确被拒的api,对项目进行检索,避免有再使用的可能

3、修改后尽快提交,等待反馈

解决方法

罗列下被拒的私有API有

  • com.apple.springboard.lockcomplete

解决方式:三方库使用,更新三方库

  • canOpenURL:

解决方式:
http://www.cocoachina.com/ios/20161021/17824.html

//打开系统scheme
+ (void)openScheme:(NSString *)scheme
{
    UIApplication *application = [UIApplication sharedApplication];
    NSURL *URL = [NSURL URLWithString:scheme];
    
    if ([application respondsToSelector:@selector(openURL:options:completionHandler:)])
    {
        [application openURL:URL options:@{}
           completionHandler:^(BOOL success) {
               NSLog(@"Open %@: %d",scheme,success);
           }];
    } else {
        BOOL success = [application openURL:URL];
        NSLog(@"Open %@: %d",scheme,success);
    }
}
  • prefs:root=

解决方式:
这是一种规避苹果机器检索的方式

urlStr = @"App-Prefs:root=Bluetooth";
urlStr = [Base64Util decodeBase64:@"QXBwLVByZWZzOnJvb3Q9Qmx1ZXRvb3Ro"];
            
+ (NSString*)decodeBase64:(NSString*)input
{
    NSData *data = [input dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
    //转换到base64
    data = [GTMBase64 decodeData:data];
    NSString * base64String = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    return base64String;
}

至此已经历时一个月时间了,还在期待审核结果,希望这次通过。

你可能感兴趣的:(App Store 审核 “私有API” Guideline 2.5.1 驳回解决方案)