Created
July 3, 2019 14:55
-
-
Save mecid/0fbec7c9fb31662f02dd2a289e3e1e05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func applicationDidEnterBackground(_ application: UIApplication) { | |
scheduleAppRefresh() | |
} | |
private func scheduleAppRefresh() { | |
do { | |
let request = BGAppRefreshTaskRequest(identifier: "pl.snowdog.example.refresh") | |
request.earliestBeginDate = Date(timeIntervalSinceNow: 3600) | |
try BGTaskScheduler.shared.submit(request) | |
} catch { | |
print(error) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment