Created
November 26, 2012 02:39
-
-
Save ChrisRisner/4146297 to your computer and use it in GitHub Desktop.
ios day 18
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
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url | |
{ | |
if (!url) { return NO; } | |
UIAlertView *alertView; | |
alertView = [[UIAlertView alloc] initWithTitle:@"Launch by URL" message:@"This app was launched from a URL" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; | |
[alertView show]; | |
return YES; | |
} |
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
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url | |
{ | |
if (!url) { return NO; } | |
UIAlertView *alertView; | |
alertView = [[UIAlertView alloc] initWithTitle:@"Launch by URL" message:@"This app was launched from a URL" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; | |
[alertView show]; | |
NSString *urlString = [url absoluteString]; | |
[[NSUserDefaults standardUserDefaults] setObject:urlString forKey:@"url"]; | |
[[NSUserDefaults standardUserDefaults] synchronize]; | |
return YES; | |
} |
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
<html> | |
<body> | |
<a href="dayeighteen://myapp?var1=a&var2=b">Open my app</a> | |
</body> | |
</html> |
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
@interface ViewController : UIViewController | |
@property (weak, nonatomic) IBOutlet UILabel *lblInfo; | |
@end |
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
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
NSString *url = [[NSUserDefaults standardUserDefaults] objectForKey:@"url"]; | |
self.lblInfo.text = url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment