【问题标题】:anyone know when the method -photoLibraryDidChange called?有人知道-photoLibraryDidChange 方法何时调用吗?
【发布时间】:2015-08-25 06:40:48
【问题描述】:

我已经多次测试该方法,可以肯定的一件事,当照片库发生变化时,该方法被调用。但是在更改之后,该方法将被再次调用两次(不做任何事情)。有谁知道为什么

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

【问题讨论】:

    标签: ios frameworks photo phasset


    【解决方案1】:

    这是一个委托方法,当您的相机胶卷内容发生变化时调用,即添加或删除照片。您需要确保您的应用正在监听更改:[[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];

    通常在以下情况下调用它:
    - (void)applicationDidEnterBackground:(UIApplication *)application
    并且未注册:
    - (void)applicationDidBecomeActive:(UIApplication *)application

    您需要导入代理<PHPhotoLibraryChangeObserver>,并且您需要确保您的应用具有相机胶卷/照片的权限。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-19
      • 2011-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多