func getData() {
let myURLString = "http://ec2-54-201-235-38.us-west-2.compute.amazonaws.com/"+Hot+".php?radius=15&curr_time="+noww+"lat="+String(lat)+"&long="+String(long)
print(myURLString)
let myURL = NSURL(string: myURLString)!
var myCardsArray = [Card]()
let mySession = NSURLSession(configuration: NSURLSessionConfiguration.defaultSessionConfiguration())
let myDataTask = mySession.dataTaskWithURL(myURL) { (data, response, error) in
guard error == nil else {
return
}
//do stuff with the data that comes out of this
}
}
所以这段代码创建一个 URL session 并获取数据并将其放入一个数组中。所有这些都有效,所以我把它排除在外了。当我提交该应用程序时,我发现它在仅支持 IPV6 的网络上崩溃并且不知道为什么。我正在使用 NSURLSession 所以它应该没问题?
最佳答案
发生这种情况是因为 AWS EC2 不支持 IPV6,这就是它在 IPV6 网络上崩溃的原因。由于 AWS ELB 支持 IPV6,您必须通过 AWS Elastic Load Balancer 集成该 EC2 实例。
查看此文档。
https://aws.amazon.com/blogs/aws/elastic-load-balancing-ipv6-zone-apex-support-additional-security/
关于ios - IPV6 崩溃 iOS,无法弄清楚发生了什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39238562/