[已解決]prefs:root 上架被拒問題

被拒郵件明顯提示:

prefs:root


看着這個prefs:root的字樣,想到了qpp跳轉到系統WIFI頁面的功能。所以猜測是因爲現在蘋果不支持這種api了,在審覈的時候發現這字樣的代碼,就被拒了。

以前做跳轉都是下面這樣的:

//iOS10
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root= WIFI"] options:@{} completionHandler:nil];
//
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root= WIFI"]];

而明顯,郵件的意思是現在不可以用這樣的prefs的描述字段了。

在網上找到解決方法是想辦法對prefs:root = WIFI 字段做轉換,這樣可以在審覈時逃過代碼掃描,具體方法如下:

//將字符串轉換爲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];

在線轉化的網站很多,這裏貼上一個:

http://www.ab126.com/goju/1711.html


更新最新進展:

關於這個問題,蘋果的要求是不可以再使用prefs:root以及App-Prefs:root的接口來做app內部和系統設置的跳轉了。現在做app系統設置跳轉,官方的只能使用UIApplicationOpenSettingURLString.

並且,明確一點,就是打開url的api也是需要做適配的。

下面直接用

  //將上面的跳轉字符串轉成字符,在進行拼接就好了
    NSData *encryptString = [[NSData alloc] initWithBytes:(unsigned char []){0x41,0x70,0x70,0x2d,0x50,0x72,0x65,0x66,0x73,0x3a,0x72,0x6f,0x6f,0x74,0x3d,0x57,0x49,0x46,0x49} length:19];//注意length長度 一定要是你所編碼的字符長度

    NSString *urlString = [[NSString alloc] initWithData:encryptString encoding:NSUTF8StringEncoding];
    NSLog(@"urlString:%@",urlString);
    if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:urlString]]) {

        if ([[UIDevice currentDevice].systemVersion doubleValue] >= 10.0) {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:nil];

        } else {

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

        }

    }

最後一點:

一些網站上說使用prefs:root配合在info.plist上加入URL scheme值爲prefs:的方案可以解決這個上架被拒的問題。但是經過我自己的測試,現在“prefs:root”是蘋果不允許的,而且這個在info.plist中加入URL scheme值爲prefs:也是不可以的。

也就是說使用“prefs:root”做跳轉 以及 在info.plist中加入URL scheme值爲prefs:,這兩者,只要存在其中一項都會被app store拒絕的。

我現在的項目已經可以上架成功了,就是把原本在info.plist中的prefs去掉之後,就上架成功了!

文章參考自:sunnycsx

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章