iOS Run Code Once a Day

后端 未结 5 937
北海茫月
北海茫月 2020-11-27 03:44

The idea behind this app is very simple: download a file. However this app will be for people who are not always within internet access range, so I need it to know that at,

5条回答
  •  长情又很酷
    2020-11-27 03:55

    Have you tried the following?

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >=7.0)
        [[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:600];
    
    
    - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
        completionHandler(UIBackgroundFetchResultNewData);
    }
    

提交回复
热议问题