yao_seu
yao_seu

Reputation: 9

anyone know when the method -photoLibraryDidChange called?

i have test the method for many times, one thing for sure ,when the photo library changes ,the method was called. but after the change , the method would be called another twice( doesn't do anything ). do any one know why

2015-08-25 14:16:04.420 PhotoLibrary[25742:3293667] enter photoLibraryDidChange methods 
2015-08-25 14:16:04.445 PhotoLibrary[25742:3283461] something inserted. 
2015-08-25 14:16:17.199 PhotoLibrary[25742:3293667] enter photoLibraryDidChange methods 
2015-08-25 14:16:17.522 PhotoLibrary[25742:3293668] enter photoLibraryDidChange methods 
2015-08-25 14:17:04.762 PhotoLibrary[25742:3295134] enter photoLibraryDidChange methods 
2015-08-25 14:17:04.796 PhotoLibrary[25742:3283461] something changed. 
2015-08-25 14:17:18.056 PhotoLibrary[25742:3295135] enter photoLibraryDidChange methods 
2015-08-25 14:17:18.366 PhotoLibrary[25742:3295137] enter photoLibraryDidChange methods 
2015-08-25 14:18:22.915 PhotoLibrary[25742:3297134] enter photoLibraryDidChange methods 
2015-08-25 14:18:22.932 PhotoLibrary[25742:3283461] something changed. 
2015-08-25 14:18:34.275 PhotoLibrary[25742:3297133] enter photoLibraryDidChange methods 
2015-08-25 14:18:34.602 PhotoLibrary[25742:3297130] enter photoLibraryDidChange methods

Upvotes: 1

Views: 1392

Answers (1)

Anish Kumar
Anish Kumar

Reputation: 1485

It is a delegate method which is called when there is a change in your camera roll content, i.e. if a photo was added or deleted. You need to make sure that your app is listening to the change: [[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];

Typically it is called in:
- (void)applicationDidEnterBackground:(UIApplication *)application
and is unregistered in:
- (void)applicationDidBecomeActive:(UIApplication *)application

You need to import delegate <PHPhotoLibraryChangeObserver> and you need to make sure your app has the permission to camera roll / photos.

Upvotes: 1

Related Questions