ios - 使用 'hidden = YES' 谓词崩溃获取 PHAsset
<p><p>如 <a href="https://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHFetchOptions_Class/index.html#//apple_ref/doc/uid/TP40014396-CH1-SW2" rel="noreferrer noopener nofollow">documentation</a> 中所列, PHAsset 支持 <code>hidden (or isHidden)</code> fetch key。但是,当我尝试获取隐藏 Assets 时,我的应用程序因以下日志而崩溃:</p>
<blockquote>
<p>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported predicate in fetch options: hidden == 1'</p>
</blockquote>
<p>这里是示例代码:</p>
<pre><code>PHFetchOptions *options = [ init];
options.wantsIncrementalChangeDetails = YES;
options.includeAllBurstAssets = YES;
options.includeHiddenAssets = YES;
options.predicate = ;
PHFetchResult *fetchResult = ;
return fetchResult;
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我在第一个答案中没有仔细阅读问题,也许这会有所帮助</p>
<p>如果您只想要隐藏的专辑,为什么不使用?
子类型:PHAssetCollectionSubtypeSmartAlbumAllHidden</p>
<pre><code>PHFetchOptions *options = [ init];
options.wantsIncrementalChangeDetails = YES;
options.includeAllBurstAssets = YES;
options.includeHiddenAssets = YES;
options.predicate = ;
PHFetchResult *albums = ;
</code></pre></p>
<p style="font-size: 20px;">关于ios - 使用'hidden = YES' 谓词崩溃获取 PHAsset,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/30735939/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/30735939/
</a>
</p>
页:
[1]