hi all,
I have the most simple ExtensionDelegate.m which works in the simulator, but doesn't on a real watch. I'm on GM candidates.
First, I set the app up so that when I press the crown to put the app into the background, I set up a pending call to the background task.
-(void)applicationDidEnterBackground {
NSDate *backgroundRefreshDate = [NSDate dateWithTimeIntervalSinceNow:1 * 60];
[[WKExtension sharedExtension] scheduleBackgroundRefreshWithPreferredDate:backgroundRefreshDate
userInfo:nil
scheduledCompletion:^(NSError *error)
{
if (error == nil) {
NSLog(@"successfully scheduled background refresh task");
} else {
NSLog(@"unable to schedule background refresh task, error:%@", error);
}
}];
}
Then I expect to get a call to the background task:
- (void)handleBackgroundTasks:(NSSet<WKRefreshBackgroundTask *> *)backgroundTasks {
NSLog(@"handleBackgroundTasks");
In the simulator this gets called pretty quickly. On a real watch it never does.
What's extra weird is that, on the watch, I don't even hit this line..
NSLog(@"successfully scheduled background refresh task");
..until after I switch back to the watch app, as though it was paused immediately upon hitting the crown.
Any ideas? I've been stumped for a few weeks now.
thanks