Skip to content

Instantly share code, notes, and snippets.

@saiday
Created December 25, 2016 08:50
Show Gist options
  • Save saiday/dfcc8024d3870e4fe0a9e31669f14d89 to your computer and use it in GitHub Desktop.
Save saiday/dfcc8024d3870e4fe0a9e31669f14d89 to your computer and use it in GitHub Desktop.
...
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
// imnotyourson://article/123, imnotyourson://user/123
if ([url.scheme isEqualToString:@"imnotyourson"]) {
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
GenericItem *item = [NSKeyedUnarchiver unarchiveObjectWithData:data];
[self navigateToDetail:item];
});
}];
[task resume];
return YES;
} else {
return NO;
}
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment