alassetslibrary

Cause of big memory allocation (memory leak?) when reading UIImage from camera roll

烈酒焚心 提交于 2019-12-06 12:45:59
问题 I try to modify FGallery (https://github.com/gdavis/FGallery-iPhone). I need it to read images from the camera roll, but I get memory leak. Old code (path is file location): @autoreleasepool { NSString *path = [NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] bundlePath],_thumbUrl]; _thumbnail = [UIImage imageWithContentsOfFile:path]; _hasThumbLoaded = YES; _isThumbLoading = NO; [self performSelectorOnMainThread:@selector(didLoadThumbnail) withObject:nil waitUntilDone:YES]; } My

Find out when my asynchronous call is finished

纵饮孤独 提交于 2019-12-06 06:03:50
I iterate through a list of photo albums on a iOS device. After having iterated through this group I want to simply print out the number of albums that were found. What do I have to change in my code that the NSLog statement is only executed, when all the albums were loaded. ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; NSMutableArray *tempArray = [[NSMutableArray alloc] init]; void (^groupBlock)(ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop){ if (group == nil){return;} [tempArray addObject:group]; }; void (^failureBlock)(NSError *) = ^(NSError *error) { NSLog(@"A

The best way to get thumbnails with ALAssetsLibrary

混江龙づ霸主 提交于 2019-12-06 03:09:50
I am handling with the ALAssetsLibrary. When I get all the thumbnails, I just use the UIImageViews to hold the thumbnails and add them to the holder. Problem is here, it is really slow to add them. Maybe ten seconds or more. If there is much photos, it will be slower. I would want to know what is the best practice to hold these thumbnails. (Many thanks!) Shamsudheen TK Use AlAsset aspectRatioThumbnail instead of fullResolutionImage for high performance The class ALAsset has two methods to get thumbnails: - (CGImageRef)thumbnail - (CGImageRef)aspectRatioThumbnail example: //ALAssetsLibrary

mach_vm_map(size=) failed (error code=3)

荒凉一梦 提交于 2019-12-06 00:50:16
问题 I am trying to save video from album to my document directory. It's working fine for videos less than 1 minute. But when I am trying to save videos more than 1 minute, my app is getting crashed. This is happening only in iPhone, in iPad it's working working for larger videos as well. This is my code : else if([mediaType isEqualToString:ALAssetTypeVideo]) { ALAssetsLibrary *librarys = [[ALAssetsLibrary alloc] init]; [librarys enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^

To Get all Images from Photo Library in iphone

故事扮演 提交于 2019-12-05 18:43:58
I trying to retrive images from Photo Library & display in my app using AssetsLibrary. I got the URL path of photos but I don't know how to get photo through it. My Code is as Follow: NSMutableArray* assetURLDictionaries = [[NSMutableArray alloc] init]; void (^assetEnumerator)( ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) { if(result != nil) { if([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto]) { [assetURLDictionaries addObject:[result valueForProperty:ALAssetPropertyURLs]]; NSLog(@"result is:%@",result); NSLog(@"asset

Save generated GIF to camera roll?

邮差的信 提交于 2019-12-05 17:08:59
问题 Thanks for reading. I've created a GIF using methods from this question: Create and and export an animated gif via iOS? I'm trying to use the only method that appears to be able to save non JPG/PNG images to the camera roll, ALAssetLibrary 's writeImageDataToSavedPhotosAlbum:metadata:completionBlock: I save the Gif to the temp Directory like this: NSString *exportPath = [NSTemporaryDirectory() stringByAppendingString:@"/animated.gif"]; NSURL *fileURL = [NSURL fileURLWithPath:exportPath

ALAsset Image Size

核能气质少年 提交于 2019-12-05 14:13:14
Given an ALAsset that represents a photo, is it possible to retrieve the size of the photo (height and width) without loading the image into a UIImageView and also without using the aspectRationThumnail method? Just a note: iOS 5.1 introduces a new property dimensions for an ALAssetRepresentation instance. This returns a CGSize structure with the dimensions of the original image and might be the best solution for this problem in the future. Cheers, Hendrik float width = asset.defaultRepresentation.dimensions.width; float height = asset.defaultRepresentation.dimensions.height; it fast, stable,

Read images from a iphone album using ALAssetsLibrary

浪尽此生 提交于 2019-12-05 12:30:29
I am trying to write a method that read assets from a album I am getting all images from all album using ALAsset, my question is how can I customize this method to read images from myAlbum /** * This method is used to get all images from myAlbum * folder in device if getAlbumImages is set to 1 * else loads all images from devices library */ -(void)readImages:(int)getAlbumImages { imageArray = [[NSArray alloc] init]; mutableArray =[[NSMutableArray alloc]init]; NSMutableArray* assetURLDictionaries = [[NSMutableArray alloc] init]; library = [[ALAssetsLibrary alloc] init]; if(getFolderImages == 1)

Open camera roll on an exact photo

旧巷老猫 提交于 2019-12-05 12:27:18
I'm developing a camera application where I'd like to put some functions that are already present in the stock app. My problem is replicating the little square in the bottom left corner (in portrait mode) where the micro-thumbnail of the photo that the user has just taken is shown; then, when the user tap on it, the photo app should open, on the last photo saved in the camera roll. I can load the thumbnail of the newest photo in camera roll with ALAssetsLibrary - I've access to it with [UIImage imageWithCGImage:[result thumbnail]] - but even if I have its ALAsset URL, I can't open the photo

How to display video from ALAsset to UICollectionview ios

会有一股神秘感。 提交于 2019-12-05 08:42:54
I tried below code to get all videos from photo library by using ALAsset . For now, i want to display all videos to a UICollectionview but it doesn't seem to display anything. Please give me some advice. Thanks in advance. -ViewDidLoad() : get all videos from Photo Library allVideos = [[NSMutableArray alloc] init]; ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init]; [assetLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) { if (group) { [group setAssetsFilter:[ALAssetsFilter allVideos]]; [group enumerateAssetsUsingBlock:^(ALAsset *asset