Created
May 16, 2015 21:03
-
-
Save choefele/99654168c75d9bd81d9d to your computer and use it in GitHub Desktop.
handleWatchKitExtensionRequest background task
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
func application(application: UIApplication, handleWatchKitExtensionRequest userInfo: [NSObject : AnyObject]?, reply: (([NSObject : AnyObject]!) -> Void)!) { | |
let completionBlock: () -> Void = { | |
reply(nil) | |
UIApplication.sharedApplication().endBackgroundTask(self.updateCacheTask) | |
} | |
updateCacheTask = application.beginBackgroundTaskWithExpirationHandler(completionBlock) | |
if let userLocation = DataProviderUtils.userLocationForUserInfo(userInfo) { | |
DataProviderService.retrieveTripsForUserLocation(userLocation, completionBlock: completionBlock) | |
} else { | |
completionBlock() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment