UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Sync contacts when app is closed

Forums > iOS

Hi! I have an app that relies on User's Contacts and I need to synchronize them daily (run some code and update application data) even if the app is closed (not in background). I've found BGTaskScheduler and NotificationCenter observer for CNContactStoreDidChange but they don't seem to be working when app is closed. Is it possible to do that in iOS?

3      

Nope. You can't do anything if your app isn't at least running in the background. Why would you need to sync contacts then, anyway? The user won't see them until the next time they open the app, which is when you should sync the contacts (probably using a background thread so as not to lock up the UI).

3      

Why would you need to sync contacts then, anyway? The user won't see them until the next time they open the app, which is when you should sync the contacts

I'd like to notify the user about upcoming birthdays. User can add a new contact, edit existing contacts details and the app will not be able to track these changes if there is no mechanism to do so when the app is not running in iOS.

3      

Hi, Have you found any solution for the app which you use need updating and sychronization daily. As I am also facing the same issue. We are using different apps for arunachal results in our mobile phone. And we have to do the same which you are doing on daily basis. Now this work is so boring. Is there any permanent solution for it?

2      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.