My app was rejected by App Store because it crashed in IPV6 network. This happened to me a second time. I have already updated my code to support for IPV6 network and two builds are moved successfully in that code.
But now again they raised this same issue, they said this problem only occurs on Wi-Fi network. Here is my tried code:
internal class Reachability
{
class func isConnectedToNetwork() -> Bool
{
var zeroAddress = sockaddr_in6()
zeroAddress.sin6_len = UInt8(MemoryLayout.size(ofValue: zeroAddress))
zeroAddress.sin6_family = sa_family_t(AF_INET6)
let defaultRouteReachability = withUnsafePointer(to: &zeroAddress) {
$0.withMemoryRebound(to: sockaddr.self, capacity: 1) {zeroSockAddress in
SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, "www.google.com")
}
}
var flags = SCNetworkReachabilityFlags()
if !SCNetworkReachabilityGetFlags(defaultRouteReachability!, &flags) {
return false
}
let isReachable = (flags.rawValue & UInt32(kSCNetworkFlagsReachable)) != 0
let needsConnection = (flags.rawValue & UInt32(kSCNetworkFlagsConnectionRequired)) != 0
return (isReachable && !needsConnection)
}
}