ios - anyone know when the method -photoLibraryDidChange called? -
i have test method many times, 1 thing sure ,when photo library changes ,the method called. after change , method called twice( doesn't ). 1 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] 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] 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] 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
it delegate method called when there change in camera roll content, i.e. if photo added or deleted. need make sure app listening change: [[phphotolibrary sharedphotolibrary] registerchangeobserver:self];
typically called in:
- (void)applicationdidenterbackground:(uiapplication *)application
, unregistered in:
- (void)applicationdidbecomeactive:(uiapplication *)application
you need import delegate <phphotolibrarychangeobserver>
, need make sure app has permission camera roll / photos.
Comments
Post a Comment