alassetslibrary

Save generated GIF to camera roll?

梦想的初衷 提交于 2019-12-04 02:06:19
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 isDirectory:NO]; Then access the NSData like: NSData * gifData = [NSData dataWithContentsOfFile:fileURL

Possible ways to speed up reading from ALAssetsLibrary and populating a UITableView

落花浮王杯 提交于 2019-12-03 23:10:29
Right now, I am using the ALAssetsLibrary to gather the photos from ALAssetsGroupSavedPhotos and ALAssetsGroupLibrary. Upon reading all the assets into an array, I populate my UITableView ([myTable reloadData]) to show the photos. I find that if the user has many photos, there is an increasing amount of delay. Is there any way to possible speed things up? The default UIIMagePicker seems to have no delay at all, despite the number of photos in the Camera Roll or PhotoLibrary. Is there any way to attain the same speed? Thank you! Just enumerate the assets you currently need to display by using

How do I get access to the album I saved photos like in camera app?

南笙酒味 提交于 2019-12-03 22:28:49
I have saved photos to my customised album in my app using code [library saveImage:self.capturedImg toAlbum:@"FunCam" withCompletionBlock:^(NSError *error) { if (error!=nil) { NSLog(@"Big error: %@", [error description]); } }]; Now I want to retrive all photos saved to that album when user click some button and show them in view like camera app (the default app on iphone) shows Please help me how can I do that? Thanks in advance Pavan Kumar Try these methods... -(void)loadNewLibraryImages { self.assetGroups = [[NSMutableArray alloc] init]; // Group enumerator Block dispatch_async(dispatch_get

ALAssetsLibrary returns same assets after adding new photo to camera roll - objective c

给你一囗甜甜゛ 提交于 2019-12-03 22:28:43
I'm using ALAssetsLibrary to enumerate first 30 photos in my Saved photos. I've created property in AppDelegate to have access to ALAssets everytime when I want, because lifetime of ALAssetsLibrary instance is tied to ALAssets lifetime. Here is my code: if(!_savedAssets) _savedAssets = [[NSMutableArray alloc] init]; else [_savedAssets removeAllObjects]; if(appDelegate.library) { [appDelegate.library release]; [appDelegate setLibrary:nil]; } appDelegate.library = [ALAssetsLibrary new]; __block int count = 0; [appDelegate.library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^

Correct way to transition between collection view and paged detail view

南楼画角 提交于 2019-12-03 21:34:24
Currently I have a uicollection view which displays a specific album in the users photos, (ALAssets library). In my mainView.m I gather the pictures: + (ALAssetsLibrary *)defaultAssetsLibrary { static dispatch_once_t pred = 0; static ALAssetsLibrary *library = nil; dispatch_once(&pred, ^{ library = [[ALAssetsLibrary alloc] init]; }); return library; } - (void)beginLoadingPhotoInfo { ... [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:assetGroupEnumerator failureBlock:^(NSError *error) {NSLog(@"Probs");} ]; } Load them (the thumbnail version) all into the collection view

NSURLSession and stream upload in background

限于喜欢 提交于 2019-12-03 20:01:19
问题 I have some problems with using NSURLSession to upload photos from Asset Library to the server. At first NSURLSession doesn't support streaming upload. I got an exception when trying to using that: @property (nonatomic, strong) NSURLSession *uploadSession; ... _uploadSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration backgroundSessionConfiguration:kUploadBackgroundURLSessionIdentifier] delegate:self delegateQueue:nil]; ... NSURLSessionUploadTask *task = [self

Can I detect if an imported ALAsset photo was taken via screenshot?

吃可爱长大的小学妹 提交于 2019-12-03 16:03:57
I have an imagePickerController that is used for importing photos from library into my app. When in ALAssetsLibraryAssetForURLResultBlock , I'm trying to find out if the ALAsset I've got in the block is a photo taken as a screen-shot or is it a "genuine" photo, taken by the camera. I've tried to go through the ALAsset's metadata dictionaries but couldn't find any flag / indication that might fit. Anyone have any ideas? For screenshot, its UTI is always a "public.png" and same size as screen (be sure you have multiply [UIScreen scale] on screen bounds width and height), just need to check these

Delete an asset (picture or video) from IPhone in IOS

守給你的承諾、 提交于 2019-12-03 12:36:56
问题 I am working on an Iphone app and I can enumerate assets using the Assetslibrary and load them into a table view. The user can delete a row (a picture / video) in the app but how do I UPDATE the Iphone photo album directly from my app? Otherwise on refreshing, the tableview will reload the previously deleted asset. 回答1: Possible duplication of https://stackoverflow.com/a/11058934/300292. Simple answer: you can't. The Photos app is the only place you can delete assets. Which is probably a good

How to Localize NSPhotoLibraryUsageDescription key (ALAssets)

放肆的年华 提交于 2019-12-03 10:58:24
问题 I'm trying to localize the NSPhotoLibraryUsageDescription key defined in the application's info.plist file (reference here). This key gives you a point to provide custom message when the app is first asking for access to your camera roll. I'm using ALAssetsLibrary to enumerate assets groups (which triggers the access request message to pop-up). So far my googling doesn't answer how I could achieve this. I want to avoid localizing the whole info.plist file as it contain a lot more non-locale

ALAssetsLibrary is too slow - Objective-C

我与影子孤独终老i 提交于 2019-12-03 09:03:23
What is a fast way to load 10-20 fullscreen images from a camera roll, saved photos? I'm using this code, but to load 10 photos I need to wait about 5-10 seconds. I'm using iPhone 4S. ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) { if(_savedPhotos.count>=11) *stop = YES; [group enumerateAssetsWithOptions:NSEnumerationReverse usingBlock:^(ALAsset *result, NSUInteger index, BOOL *needToStop) { NSLog(@"%d",index); if(_savedPhotos.count<11) { UIImage *image = [UIImage