ios - 在连接到 IPv6 网络的 Wi-Fi 上运行 iOS 10.0

标签 ios swift connection ipv6

Iphone app 被拒绝的原因是 “在连接到 IPv6 网络的 Wi-Fi 上运行 iOS 10.0 的 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.
    }


}

最佳答案

关于ios - 在连接到 IPv6 网络的 Wi-Fi 上运行 iOS 10.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39482481/

相关文章:

iOS 人员选择器更改按钮颜色

ios - 如何在 ios 中为 UITextView 设置内容插入

objective-c - 同步多个 UITableView 实例的滚动位置

arrays - 无法将类型 'Meme!' 的值转换为预期的参数类型 '@noescape (Meme) throws -> Bool'

ios - 如何在 swift 中设置 webview 窗口的大小?

postgresql - 使用 SDBC 从 libreoffice base 连接到 PostgreSQL

ios - 带有 facebook/gmail 的 OAuth 不适用于 iOS 模拟器(Cordova 应用程序 + Firebase)

ios - 在 Swift 中查找数组中的值(类似于 Excel 中的 VLOOKUP 函数)

android - HTTP url 连接安卓

安卓 : Iptables blocking of incomming connections