【问题标题】:iPhone : Photos framework : how to get only those album/images which created by my app only not by others?iPhone:照片框架:如何仅获取由我的应用程序创建的那些相册/图像,而不是由其他人创建的?
【发布时间】:2015-03-11 12:56:40
【问题描述】:

我正在创建一个应用程序,例如照片应用程序。我的应用程序创建相册并捕获图像并将它们保存在照片应用程序的相册中。为此,我正在使用照片框架。当我获取专辑时,它会为我提供由我的应用程序以及其他应用程序创建的专辑。所以我只想要那些由我的应用程序创建的专辑/图像,而不是由其他应用程序创建的。

【问题讨论】:

    标签: ios iphone camera photosframework


    【解决方案1】:

    没有直接的方法可以做到这一点。但这是一种解决方法。

    PHFetchResult *topLevelUserCollections = [PHCollectionList fetchTopLevelUserCollectionsWithOptions:nil];
        self.collectionsFetchResults = @[topLevelUserCollections];
    
        for (PHFetchResult *fetchResult in self.collectionsFetchResults) {
                for (PHAssetCollection *assetCollection in fetchResult) {
                    BOOL shouldShowCollection = NO;
                    if ([assetCollection.localizedTitle isEqualToString:@"YOUR_APP_NAME"]) {
                        shouldShowCollection = YES;
                    }
    
                    if (shouldShowCollection) {
                       //collectionsToShow are the collections that you will show up in your table view
                       [self.collectionsToShow addObject:assetCollection];
                    }
                }
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-11
      • 2010-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多