#import <SystemConfiguration/SCNetworkReachability.h>
#include <netinet/in.h>
- (BOOL) connectedToNetwork
{
// Create zero addy
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
// Recover reachability flags
SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
SCNetworkReachabilityFlags flags;
BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
CFRelease(defaultRouteReachability);
if (!didRetrieveFlags)
{
printf("Error. Could not recover network reachability flags\n");
return 0;
}
BOOL isReachable = flags & kSCNetworkFlagsReachable;
BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired;
BOOL nonWiFi = flags & kSCNetworkReachabilityFlagsTransientConnection;
return ((isReachable && !needsConnection) || nonWiFi) ?
(([[NSURLConnection alloc] initWithRequest:[NSURLRequest
requestWithURL: [NSURL URLWithString:@"http://www.apple.com/"]
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20.0]
delegate:self]) ? YES : NO) : NO;
}
When it’s displayed on an iPhone Home screen, the same application icon would look like this:
An icon that appears to float on a visible black background looks especially unattractive on a Home screen that displays a custom picture.
A high-resolution default document icon that uses the 114 x 114 pixel white star iPhone app icon would look like this:
For iPad, a default document icon that uses the 72 x 72 pixel white star app icon would look like this:
Optionally, you can provide custom artwork for iOS to use instead of your application icon. Because people will see your document icon in different places, it’s best to design an image that's memorable and clearly associated with your application. Your custom artwork should be attractive, expressive, and detailed.
Similarly, if you supply a 44 x 58 pixel icon that looks like the image on the left, iOS creates a document icon that looks like the image on the right:

To create a 320 x 320 pixel document icon:





