I am creating errors for my API calls and would like to check the status when the Internet connection is not available.
dataTaskWithRequest seems to do a great job of this and returns an NSError with code -1009 with a description of the Internet connection. I donβt have to wait until the request comes out.
dataTaskWithRequest
NSError
When would I like to use the Framework Reachability Framework? Thanks
I did a bit of work and found my answer in Apple Docs.
The recommended recommendation is to try to connect. If there is a connection problem, it gives you an NSError object that you should use to verify connectivity.
Apple recommends using Reachability only as a way to diagnose errors and further debug known issues. It looks like you should only use accessibility for detection when the network returns to the network after a failure.
"Always try to connect. Do not try to guess if a network service is available and do not cache this definition.
If the connection fails, use the SCNetworkReachability API to help diagnose the cause of the failure.
source: https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/WhyNetworkingIsHard/WhyNetworkingIsHard.html#//apple_ref/doc/uid/TP40010220-CH13-SW3
"When a task completes, the NSURLSession object calls the delegate method URLSession:task:didCompleteWithError: either with an error object or with nil (if the task completed successfully).
NSURLSession
URLSession:task:didCompleteWithError:
If the task fails, most applications should retry the request until the user cancels the download or the server returns an error indicating that the request will never be completed. However, your application should not retry immediately. Instead, it should use reachability APIs to determine if the server is available, and should only make a new request when it receives a notification that availability has changed. "
A source:
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/URLLoadingSystem/NSURLSessionConcepts/NSURLSessionConcepts.html
Source: https://habr.com/ru/post/1242897/More articles:How can I use Angular 2 in a .NET 4 Web Forms project? - angularjsWhy should I use static methods to access the database - c #Textarea display setting: none lose value when trying to save - javascriptAWC Lambda VPC access error: "CreateNetworkInterface" - amazon-web-servicesDoes one state object have mass rendering in Angular2? - angularSDWebImage does not assign an image with url - The uploaded image has 0 pixels - ioshttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1242899/ngrxstore-subscription-to-part-of-a-store-and-avoid-detecting-changes-to-other-parts&usg=ALkJrhik20Cn2TKtxtDAm6npJpWgKUFMygLLVM: The difference between βneedsβ and βuserβ in Value statements or classes - llvmHow to ignore localhost in Azure applications - c #How to get declared and inherited elements from TypeInfo - inheritanceAll Articles