Skip to content

Instantly share code, notes, and snippets.

@ben-ng ben-ng/something.m
Last active Aug 29, 2015

Embed
What would you like to do?
@implementation MainViewController {
NSURLSession *_session;
}
- (void) doSomethingElse
{
[self doSomethingWithCompletionHandler: ^(){
// create session.. add download tasks..
// _session = blah blah
// _session.createDownloadTask etc
[self performSelector:@selector(cancel) withObject: nil afterDelay: 1];
}];
}
- (void) cancel
{
if(_session) {
[_session invalidateAndCancel];
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.