(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];
}
(void)photoLibraryDidChange:(PHChange *)changeInstance{
//PHFetchResultChangeDetails result = [changeInstance changeDetailsForFetchResult:<#(nonnull PHFetchResult )#>];//这个对象该如何获取呢?
//PHFetchResultChangeDetails albumChanges = [changeInstance changeDetailsForObject:<#(nonnull PHObject )#>];//这个对象该如何获取呢?
如上所述,这个需求是当相册的图片发生变化时,就会跳用这个方法,但是我不知道以上两个方法所传的参数是怎么获取,请求帮忙,谢谢。
}
迷茫2017-04-18 09:54:14
PHFetchResult
可以把它看做是一个由 PHAsset
填充的数组,跟 NSArray
的用法类似。有关此对象的获取可以通过 PHAsset
的实例方法获得。PHObject
是 PHAsset
的抽象父类,有用的属性只有一个 localIdentifier
,意思就是图片资源的标识符,所以也可以通过这个属性来获得 PHFetchResult
Collection object.
For other main usages, you can refer to the official document Photos
You are also welcome to refer to the article I wrote about the actual project application of PhotoKit: Photos Framework usage notes