2 Replies
      Latest reply on Aug 30, 2017 3:38 PM by Rudayb
      breville Level 1 Level 1 (0 points)

        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
                                                                  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 {


        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.



        • Re: handleBackgroundTasks not called
          breville Level 1 Level 1 (0 points)

          Good news.  In the latest watch os beta release notes, I found this tidbit:


          When a WatchKit app is in an active debug session and in the background, you can send background tasks to the app through the Debug menu. “Simulate Background Refresh” sends a WKApplicationRefreshBackgroundTask and “Simulate UI Snapshot” sends a WKSnapshotRefreshBackgroundTask. Note that these tasks do not have any userInfo data that may have been registered from a previous request from the app. Also note that these tasks are not sent if the app is in the foreground.

          • Re: handleBackgroundTasks not called
            Rudayb Level 1 Level 1 (0 points)

            Were you able to find a solution to this issue? I am still noticing this issue.