Created
February 17, 2012 16:48
-
-
Save pratikshabhisikar/1854318 to your computer and use it in GitHub Desktop.
Blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AppStoreConnectionHandler *appStoreConnection = [[AppStoreConnectionHandler alloc] init]; | |
[appStoreConnection initiateConnectionForAppURL:[NSURL URLWithString:appURL] withCompletionBlock:^(NSURL *appURL, BOOL finished, NSError *error){ | |
if (finished) { | |
BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:appURL]; | |
if (canOpenURL) { | |
[[UIApplication sharedApplication] openURL:appURL]; | |
}else { | |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Sorry" message:@"Application cannot open the URL" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; | |
[alert show]; | |
} | |
}else { | |
if (error) { | |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Sorry" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; | |
[alert show]; | |
} | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment