Commit cf0ab5c0 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

app delegate: dispatch background task when receiving a WK Extension request

parent dc5ffebb
......@@ -604,10 +604,18 @@
}
#pragma mark - watch struff
- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply {
NSDictionary *reponseDict = nil;
- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply
{
/* dispatch background task */
__block UIBackgroundTaskIdentifier taskIdentifier = [application beginBackgroundTaskWithName:nil
expirationHandler:^{
[application endBackgroundTask:taskIdentifier];
taskIdentifier = UIBackgroundTaskInvalid;
}];
NSDictionary *responseDict = nil;
if ([userInfo[@"name"] isEqualToString:@"getNowPlayingInfo"]) {
reponseDict = [self nowPlayingResponseDict];
responseDict = [self nowPlayingResponseDict];
} else if ([userInfo[@"name"] isEqualToString:@"playpause"]) {
[_movieViewController playPause];
} else if ([userInfo[@"name"] isEqualToString:@"skipForward"]) {
......@@ -619,10 +627,11 @@
} else {
NSLog(@"Did not handle request from WatchKit Extension: %@",userInfo);
}
reply(reponseDict);
reply(responseDict);
}
- (void)playFileFromWatch:(NSDictionary *)userInfo {
- (void)playFileFromWatch:(NSDictionary *)userInfo
{
NSManagedObject *managedObject = nil;
NSString *uriString = userInfo[@"URIRepresentation"];
if (uriString) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment