Tech

BGTaskScheduler error

I have a code that returns errors no matter what I do with it. I want to get WatchDog kill when calling [BGTaskScheduler submitTaskRequest] and below is the code that needs a review:

  • (void)applicationDidEnterBackground:(UIApplication *)application {
    BGAppRefreshTaskRequest *refreshRequest = [[BGAppRefreshTaskRequest alloc] initWithIdentifier:kBGRefreshTaskIdentifier];
    @try {
    NSError *error ;
    [[BGTaskScheduler sharedScheduler] submitTaskRequest:refreshRequest error:&error];
    } @catch (NSException *exception) {
    }
    }

Hello
Please check the link below