Skip to content

Instantly share code, notes, and snippets.

@buixuanhai
Created March 26, 2018 07:11
Show Gist options
  • Save buixuanhai/e5b1cb11c944fb334a734b6555ee0805 to your computer and use it in GitHub Desktop.
Save buixuanhai/e5b1cb11c944fb334a734b6555ee0805 to your computer and use it in GitHub Desktop.
Get query params on launching app
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
NSLog(@"Opened by url %@", url.query);
NSDictionary *params = [self parseURL:url];
for(id key in params)
NSLog(@"key=%@ value=%@", key, [params objectForKey:key]);
NSString *amount = [params objectForKey:@"amount"];
self.amount = [amount intValue];
[[NSUserDefaults standardUserDefaults] setObject:amount forKey:@"amount"];
[[NSUserDefaults standardUserDefaults] synchronize];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment