我正在使用 Apples Photos Framework 将 PHAssetCollections 加载到我的应用程序中。我总是得到智能收藏的英文名称。例如,我得到的是“收藏夹”而不是“收藏夹”(瑞典语)。我认为localizedTitle 属性会返回模拟器或iPhone 运行的语言。(在使用瑞典语和地区的 iPhone 上运行)。
有人遇到过这种情况么?示例代码:
NSArray *collectionsFetchResults;
NSMutableArray *localizedTitles = [[NSMutableArray alloc] init];
PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum
subtype:PHAssetCollectionSubtypeAlbumRegular options:nil];
PHFetchResult *syncedAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum
subtype:PHAssetCollectionSubtypeAlbumSyncedAlbum options:nil];
PHFetchResult *userCollections = [PHCollectionList fetchTopLevelUserCollectionsWithOptions:nil];
// Add each PHFetchResult to the array
collectionsFetchResults = @[smartAlbums, userCollections, syncedAlbums];
for (int i = 0; i < collectionsFetchResults.count; i ++) {
PHFetchResult *fetchResult = collectionsFetchResults[i];
for (int x = 0; x < fetchResult.count; x ++) {
PHCollection *collection = fetchResult[x];
localizedTitles[x] = collection.localizedTitle;
NSLog(@"%@", collection.localizedTitle); //<= Always prints english names
}
}