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?
AppDelegate.swift
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()
internetCheck!.startNotifier()
statusChangedWithReachability(currentReachabilityStatus: internetCheck!)
}
func applicationDidEnterBackground(_ application: UIApplication) {
internetCheck!.stopNotifier()
}
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)
}
}