1 Reply
      Latest reply: Nov 2, 2016 2:34 AM by eskimo RSS
      andreaantonioni Level 1 Level 1 (0 points)

        Our app has been rejected 4 times cause we show an alert saying "Hey, you don't have an internet connection" when instaed the device is connected to a IPv6 network.

        The problem is that we don't have any reachability problem during tests. We've also followed  Technical Q&A QA1764 but everything works.

        It couldn't be a server-side problem cause at this point we' not made any http request yet.


        We’ve replaced our  Reachability pod with the Reachbility files written in Obj C we’ve found in  Apple’s documentation and this is our code


        Do you see some mistakes?


        class AppDelegate: UIResponder, UIApplicationDelegate {
          var window: UIWindow?
          var internetCheck: Reachability?
          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
               // MARK: - Reachability
               NotificationCenter.default.addObserver(self, selector: #selector(AppDelegate.reachabilityChanged(notification:)), name: NSNotification.Name.reachabilityChanged, object: nil)
               internetCheck = Reachability.forInternetConnection()
               statusChangedWithReachability(currentReachabilityStatus: internetCheck!)
          func applicationDidEnterBackground(_ application: UIApplication) {
          func applicationWillTerminate(_ application: UIApplication) {
               NotificationCenter.default.removeObserver(self, name: NSNotification.Name.reachabilityChanged, object: nil)
          //- - -
          // MARK: - Reachability
          //- - -
          func reachabilityChanged(notification: NSNotification) {
             let reachability = notification.object as! Reachability
             statusChangedWithReachability(currentReachabilityStatus: reachability!)
          func statusChangedWithReachability(currentReachabilityStatus: Reachability) {
             let networkStatus: NetworkStatus = currentReachabilityStatus.currentReachabilityStatus()
             switch networkStatus.rawValue {
             case NotReachable.rawValue:
             // MARK: - START Reachibility Pop-Up Alert
                 reachabilityStatus = NOACCESS
                 if let vc = UIApplication.shared.keyWindow?.topController() {
                     print("- - - AppDelegate.reachability.whenUnreachable: VC - - -")
                     AlertManager.noInternetConnection(viewController: vc)
                 } else {
                     print("- - - AppDelegate.reachability.whenUnreachable: NIL - - -")
                     AlertManager.noInternetConnection(viewController: nil)
             // MARK: - END Reachibility Pop-Up Alert
             case ReachableViaWiFi.rawValue: reachabilityStatus = WIFI
             case ReachableViaWWAN.rawValue: reachabilityStatus = WWAN
             default: return
             NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ReachStatusChanged"), object: nil)
        • Re: Reachability iOS 10.1 with IPv6 network
          eskimo Apple Staff Apple Staff (6,005 points)

          I don’t know what’s causing your specific problem but you seem to have the wrong end of the reachability stick here.  In general you shouldn’t use reachability to ‘preflight’ requests.  Rather, you should make the request and then, if something goes wrong, use reachability to help the user recover (guiding the user as to what went wrong, triggering automatic retries when reachability changes, and so on).  This has a couple of important consequences:

          • It’s rare to ever need Reachability.forInternetConnection() because, if a request has failed, you know the destination of that request, and thus can create a specific reachability query with that destination.

          • You don’t ever post error alerts based solely on a reachability query.  Rather, you post the alert based on a specific network failure and then supplement that with information from reachability.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"