在连接到 IPv6 网络的 Wi-Fi 上运行 iOS 10.0
Posted
技术标签:
【中文标题】在连接到 IPv6 网络的 Wi-Fi 上运行 iOS 10.0【英文标题】:running iOS 10.0 on Wi-Fi connected to an IPv6 network 【发布时间】:2016-09-14 04:28:25 【问题描述】:Iphone 应用程序被拒绝的原因是 “当 的 iPad 和 iPhone 上进行审查时,我们在您的应用程序中发现了一个或多个错误。” 谁能帮忙解决一下?
import UIKit
let useClosures = false
class ViewController: UIViewController
let reachability = Reachability.reachabilityForInternetConnection()
@IBOutlet weak var WebView: UIWebView!
override func viewDidLoad()
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
view.backgroundColor = UIColor.redColor()
let URL = NSURL(string: "https://gph-shop.com/tracing")
WebView.loadRequest(NSURLRequest(URL: URL!))
if (useClosures)
reachability?.whenReachable = reachability in
print("Reachable")
reachability?.whenUnreachable = reachability in
print("Unreachable")
else
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(ViewController.reachabilityChanged(_:)), name: ReachabilityChangedNotification, object: reachability)
reachability?.startNotifier()
// Initial reachability check when the app starts
if let reachability = reachability
dispatch_async(dispatch_get_main_queue())
if reachability.isReachable()
let alertController = UIAlertController(title: "", message: "wi-fi connected", preferredStyle: .Alert)
let defaultAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
alertController.addAction(defaultAction)
self.presentViewController(alertController, animated: true, completion: nil)
else
let alertController = UIAlertController(title: "Alert", message: "Please connect to internet", preferredStyle: .Alert)
let defaultAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
alertController.addAction(defaultAction)
self.presentViewController(alertController, animated: true, completion: nil)
deinit
reachability?.stopNotifier()
if (!useClosures)
NSNotificationCenter.defaultCenter().removeObserver(self, name: ReachabilityChangedNotification, object: nil)
func reachabilityChanged(note: NSNotification)
let reachability = note.object as! Reachability
// Initial reachability check while surfing in the app
if reachability.isReachable()
let alertController = UIAlertController(title: "Alert", message: "Reachable", preferredStyle: .Alert)
let defaultAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
alertController.addAction(defaultAction)
self.presentViewController(alertController, animated: true, completion: nil)
else
let alertController = UIAlertController(title: "Alert", message: "Please connect to internet", preferredStyle: .Alert)
let defaultAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
alertController.addAction(defaultAction)
self.presentViewController(alertController, animated: true, completion: nil)
override func didReceiveMemoryWarning()
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
【问题讨论】:
【参考方案1】:您需要在 NAT64 网络中调试您的应用。 (您可以使用 macOS 创建它。)
Apple 支持文章如下: https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html
【讨论】:
以上是关于在连接到 IPv6 网络的 Wi-Fi 上运行 iOS 10.0的主要内容,如果未能解决你的问题,请参考以下文章
应用程序拒绝 NSUrlConnection IPv6 网络问题 iOS