I’m using SBJson to retrive data from URL. How to check if I have access to the URL before downloading. I want to check this, sometime application crash if there is no network connection.
Here is my code
id response = [self objectWithUrl:[NSURL URLWithString:@"http://myurl.com/Service.svc/GetId"]];
*I’m using stringWithUrl and objectWithUrl method to download the JSON.
Use the Reachability API and use that URL as your hostname you are testing
http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html