iOS 非公开API prefs:root=Privacy 被拒~解决方法

 联系人:石虎 QQ:1224614774昵称:嗡嘛呢叭咪哄

                     QQ群:807236138群称: iOS 技术交流学习群

CSND:https://blog.csdn.net/shihuboke/article/details/82531076

新浪:http://blog.sina.com.cn/s/blog_14679a7d20102xvc0.html

一、概念

1.被拒图

被拒原因图

iOS 非公开API prefs:root=Privacy 被拒~解决方法_第1张图片

2.被拒文案

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.

3.被拒文案 百度翻译:

指南2.5.1-性能-软件要求

您的应用程序使用“Prfs:root =”非公共URL方案,它是私有实体。在App Store中不允许使用非公开API,因为如果这些API改变,它会导致用户体验不佳。

下一步

为了解决这个问题,请修改您的应用程序以使用公共API提供相关的功能,或者使用“Prfs:root”或“AppPrfs:root”URL方案来删除功能。

如果没有可供选择的功能来提供应用程序所需的功能,则可以提交增强请求。


4.官方文档帮助:

Bug Reporting

https://developer.apple.com/bug-reporting/


二、代码出现实例

1.被拒代码图

被拒代码图

iOS 非公开API prefs:root=Privacy 被拒~解决方法_第2张图片

2.原因

问题就是存在"prefs:root="这样的,官方不允许,但是我们项目是从前年开始吧我记得,就是从iOS8开始适配的,所以刚开始保留了8之前的写法,只是加了个判断(就是上边的ifelse)

那么,直接删掉就好啦,反正也不适配iOS8之前的了,这里说一下:

iOS8之后其实在uiaplication中新出了这样的东西:


NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];

if ([[UIApplication sharedApplication] canOpenURL:url]) {

       [[UIApplication sharedApplication] openURL:url];

}


三、解决方法~1:

1.修复代码图

修复代码图

iOS 非公开API prefs:root=Privacy 被拒~解决方法_第3张图片

2.拷贝代码

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {

    if (buttonIndex == 1) { // 去设置界面,开启相机访问权限

        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

    }

}


四、解决方法~2:

对prefs:root = Bluetooth字段做转换,这样可以在审核时逃过代码扫描,具体方法如下:

//将字符串转换为16进制

NSData *encryptString = [[NSData alloc] initWithBytes:(unsigned char []){0x70,0x72,0x65,0x66,0x73,0x3a,0x72,0x6f,0x6f,0x74,0x3d,0x4e,0x4f,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x49,0x4f,0x4e,0x53,0x5f,0x49,0x44} length:27];

NSString *string = [[NSString alloc] initWithData:encryptString encoding:NSUTF8StringEncoding];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string] options:@{} completionHandler:nil];

⚠️注意:建议使用解决方法~1:


谢谢!!!

你可能感兴趣的:(iOS 非公开API prefs:root=Privacy 被拒~解决方法)