How to detect Photo Library changes when app was terminated and now restarted?
Asked Answered
B

1

11

Using the new Photos Framework, I am able to detect changes to the photo library when the app is running and in the background using photoLibraryDidChange.

But when the app is terminated (either by the user or by the system), how can i detect the changes when the app is restarted?

For detecting new photos, I was able to save a last updated timestamp and just refetch the photo library when I restart. But I couldn't think of a way for detecting deleted and changed photos.

Any help is appreciated!

Thank you!

Birdman answered 27/4, 2015 at 19:1 Comment(0)
S
0

I'm thinking about it, too.It's similar to the facebook messenger's photo magic.When you take a new photo,you will receive a notification even if the app is terminated.And it works for iOS7. That is to say we can do that too.

An important detail about using the NSURLSessionTasks is that iOS will take over handling your long running network download or upload, even after your app has terminated or been set as suspended.

Also we have the other weapon Remote Notifications For Background Fetching for silent push notifications.So we can combine this two things to implement new photo detecting.There's another thing we should consider is that there will be throttling should Apple consider your push requests too frequent.So we should control the frequence of notification.

More details is in iOS 7 Tutorial Series: What's New In Background Multitasking

And the demo A sample service to support the iOS 7 backgrounding tutorial

All the things is about how to detect photo when the app is terminated. I will edit this answer when I complete my work for detecting delete and change.Hope it's helpful : )

Saltillo answered 8/3, 2016 at 7:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.