Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
676 views
in Technique[技术] by (71.8m points)

objective c - when there is no internet connection the URLSession returning NSURLErrorTimedOut instead of NSURLErrorNotConnectedToInternet iOS 14

When i execute code with my internet connection disabled. In iOS13 the completionBlock gets called immediately and I have this error

Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline."

But, when I execute exactly the same code under iOS14 the completion block gets called after one minute (the timeout) and the error that i have is different

Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."

How to get error.Code=-1009 in iOS14, Thanks in advance.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...