I have many rejections for my app due to bug in ipv6-only network. I don't use any external libraries. The only class for connectin to my server is :
class ServerAccess{
class func GetData(ScriptFile:String, PostData: String, completionHandler: @escaping (NSArray) -> ()) {
let ServerUrl: String = "https://eaynd.gr/test.php"
let myUrl = URL(string: ServerUrl+ScriptFile);
var request = URLRequest(url:myUrl!)
let postString = PostData
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postString.data(using: .utf8)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data, error == nil else {
return
}
if let httpStatus = response as? HTTPURLResponse, httpStatus.statusCode != 200 { // check for http errors
print("statusCode should be 200, but is \(httpStatus.statusCode)")
print("response = \(String(describing: response))")
}
do {
let resp = String(data: data, encoding: .utf8)
print(resp!)
let data = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as! NSArray
completionHandler(data)
} catch let error as NSError {
print(error)
}
}
task.resume()
}
}
I test also by the Nat64 hotspot guide from a mac air 13 and work like a charm on ipad 2 mini.
Server is ipv6 ready.
Any suggestions?
Any help?
Thanks.