Reachability class should be built in
| Originator: | coryalder | ||
| Number: | rdar://12148871 | Date Originated: | 22-Aug-2012 12:39 AM |
| Status: | Open | Resolved: | |
| Product: | iPhone SDK | Product Version: | 5.1 |
| Classification: | Enhancement | Reproducible: |
The Reachability class Apple provides (https://developer.apple.com/iphone/library/samplecode/Reachability/index.html) is very useful. So useful in fact that it's used by many *many* libraries on iOS. Since Objective-C doesn't have namespaces, this means you frequently run into conflicts between libraries.
The functionality is so basic, and so core, I don't understand why it isn't provided by the OS directly. A simple NSReachability class would be a wonderful wonderful thing. It would also prevent newbie developers from using code like:
NSString *reachable = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://google.com"] encoding:NSUTF8StringEncoding error:&error];
if ([reachable rangeOfString:@"I'm feeling lucky!"].location != NSNotFound) {
// has internet connection
}
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!