Created
December 25, 2016 08:50
-
-
Save saiday/dfcc8024d3870e4fe0a9e31669f14d89 to your computer and use it in GitHub Desktop.
This file contains 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 | |
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