iOS 打包上架被拒 prefs:root

当我们提交审核过程中经常会遇到各种各样的审核被拒原因,其中就包含了prefs:root  被拒

当我们被拒后会收到下面这个驳回原因

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.
Specifically, your app uses the following non-public URL scheme:
app-prefs:root=wifi
prefs:root=wifi
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 use Feedback Assistant to submit an enhancement request.
 

使用百度翻译

您的应用程序使用“prefs:root=”非公共URL方案,这是一个私有实体。应用程序商店不允许使用非公共api,因为如果这些api发生更改,可能会导致不良的用户体验。

具体来说,您的应用程序使用以下非公开URL方案:

应用程序首选项:根=wifi
首选项:根=wifi

在以后提交此应用程序时继续使用或隐藏非公共API可能会导致您的Apple开发者帐户终止,并从应用程序商店中删除所有关联的应用程序。

解决办法

1、就是上线的时候直接删除这些代码,然后在相应的位置加一些问题提示,让用户自己主动去开启,不过这个方法很麻烦

2、prefs:root=的URL换成UIApplicationOpenSettingsURLString,这个是公共api可以放心使用,但是这个方法有些时候并没prefs:root=来的方便,但是也相对第一个方法要好一些

扫描二维码关注公众号,回复: 10431525 查看本文章

个人建议使用方法2,但是有的时候老版本的.a文件和.framework也包含了响应的prefs:root=,我们也是需要更改的,我们需要在终端命令行上输入下面这个命令

grep -lr "prefs:root=" *

找到了使用prefs:root=的第三方包,然后更改即可

3、把你要使用的字符串data转成字符串即可,例如,"App-prefs:root=WIFI"

+(void)openSettingsURLString
{
    //App-prefs:root=WIFI字符串的data类型
    NSData *encryptString = [[NSData alloc] initWithBytes:(unsigned char []){0x41,0x70,0x70,0x2d,0x70,0x72,0x65,0x66,0x73,0x3a,0x72,0x6f,0x6f,0x74,0x3d,0x57,0x49,0x46,0x49} length:19];
   NSString *string = [[NSString alloc] initWithData:encryptString encoding:NSUTF8StringEncoding];
    if (@available(iOS 10.0, *)) {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:string] options:@{} completionHandler:^(BOOL success) {
            if (success) {
                NSLog(@"Opened url");
            }
        }];
    } else {
        // Fallback on earlier versions
       [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
    }
}
发布了10 篇原创文章 · 获赞 5 · 访问量 1470

猜你喜欢

转载自blog.csdn.net/weixin_38496080/article/details/105270988