swift - How can a sync of IOS reminders programmatically be triggered / forced? -
i writing task mgmt app using ekreminder. works when using on 1 ios device.
when use on 2 devices (same apple account), realise reminder changes sync significant delay , incomplete. (tried icloud, google, company outlook)
this seems unrelated app (same happens if change reminders directly in reminder ios app).
can programmatically force sync of reminders whatever service (e.g. icloud) linked , trigger out of app?
@losiowaty suggests valid solution in comments question, think there's bit more information following solution(s) provide. fair, have noticed exact same issue apple reminders app, , think in general solution applies ios carry on same notifications have similar issues on macos well.
for ios, though, issue seems be:
- two ios devices on same apple icloud account both specific reminder push notification. issue is, though, clearing push notification on 1 device not sync second device in cases of right now. question asked above's context, understand.
the second, not recognized problem, can tell, problem due fact "host" application isn't clearing it's own push notifications, speak. mean is:
- ipad , iphone receive push notification reminders app 12:00 todo item, @ 12:00.
- ipad push notification acted on, marked completed, , cleared on ipad immediately
- iphone push notification still there (the issue we're attempting solve), not removed until removed (opening reminders app not push notification not clear this).
the reason push notification isn't being cleared application, , though it's irrelevant information (since cleared after being marked completed (or snoozed) on device), push notification system doesn't know (since pushes payloads of information, unless use ttl on these, that's different answer). way fix that, most/some apps use extent, be:
1) stated in comment, in bullet point 2 action (marked completed, , cleared device 1) update backend (icloud in case) item
complete, sends silent push associated devices clears push notification (this happen in form of application background task, notification service extension
apple link here (ios 10+ only)
2) method keep internal "secret" key unique each push notification send (across associated devices). can associate 1 "task" object (in reminders app context example, can data object held in app) set of push notification "secret" keys (which can expire on custom timer if feel these getting out of hand, since pushes viewed or irrelevant after 30 days in use cases). this, along mechanism make application update it's data, if app notices device has push notifications shouldn't (based on set of "secret" keys associated "active" data), should clear them you. ends same result method 1, doesn't require silent push (a socket can used, or else entirely), , rely on basic background job
it looks either way, need kind of background task processing act when happens (either through notification service extension as linked or through simple background task apple supports).
i hope answers question , points in right direction building!
Comments
Post a Comment