Last active
August 29, 2015 14:04
-
-
Save ben-ng/65bdbce3e5af82e11a21 to your computer and use it in GitHub Desktop.
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
@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