I am using NSURLConnection in an iPhone app as so:
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest: request delegate: self];
this works for me and is taken from apple seismic xml project:
- (BOOL)isDataSourceAvailable
{
static BOOL checkNetwork = YES;
if (checkNetwork) { // Since checking the reachability of a host can be expensive, cache the result and perform the reachability check once.
checkNetwork = NO;
Boolean success;
const char *host_name = "twitter.com"; // your data source host name
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, host_name);
SCNetworkReachabilityFlags flags;
success = SCNetworkReachabilityGetFlags(reachability, &flags);
_isDataSourceAvailable = success && (flags & kSCNetworkFlagsReachable) && !(flags & kSCNetworkFlagsConnectionRequired);
CFRelease(reachability);
}
return _isDataSourceAvailable;
}