- 情景:
等待蘋果審核上線時,發現因為IPV6被拒了。這是悲劇,以下是蘋果審核給我的理由:
We discovered one or more bugs in your app when reviewed on iPad running iOS 11.4.1 on Wi-Fi connected to an IPv6 network. Specifically, your app displayed an error message upon launch. Next Steps To resolve this issue, please run your app on a device to identify any issues, then revise and resubmit your app for review. If we misunderstood the intended behavior of your app, please reply to this message in Resolution Center to provide information on how these features were intended to work. For new apps, uninstall all previous versions of your app from a device, then install and follow the steps to reproduce the issue. For updates, install the new version as an update to the previous version, then follow the steps to reproduce the issue. Resources For information about testing your app and preparing it for review, please see Technical Note TN2431: App Testing Guide. For a networking overview, please review About Networking. For a more specific overview of App Review’s IPv6 requirements, please review the IPv6 and App Review discussion on the Apple Developer Forum. Please see attached screenshot for details.
還附了一張圖:

- 思考與排查:
用自己的網絡請求是沒有任何問題的,但是到了蘋果審核就提示網絡問題;但是,首頁的數據已經出來了,這個說明,其實接口在ipv6的情況下是可以調用的,排除鏈接不上ipv6網絡的問題。那么這個網絡請求失敗是哪里來的呢?
與朋友幾番討論,可能存在這樣的問題:就是在申請網絡使用權限之前,就開始走網絡請求了,因此在申請網絡使用權限之前的借口會被拒,導致接口請求失敗。
- 解決方法:
順着這個思路,做了一個投機取巧的方法,就是在appdelegate的didFinishLauch方法里面,先調用一個不相干的接口,比如“百度”,這樣第一個申請網絡請求的接口不通過也不會導致程序其他的相關接口。
- 代碼如下:
第一步:聲明一個調用百度請求的方法

第二步:在appdelegate調用這個方法

按照這個修改,重新提交了一個版本,第二天審核就通過了。
此方法僅供參考,望遇到類似問題的隊友們能有所幫助。
