alassetslibrary

UIImage Orientation Swift

 ̄綄美尐妖づ 提交于 2019-12-21 21:24:30
问题 I have written this code to capture an image using the AVFoundation library in Swift: @IBAction func cameraButtonWasPressed(sender: AnyObject) { if let videoConnection = stillImageOutput.connectionWithMediaType(AVMediaTypeVideo){ stillImageOutput.captureStillImageAsynchronouslyFromConnection(videoConnection){ (imageSampleBuffer : CMSampleBuffer!, _) in let imageDataJpeg = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(imageSampleBuffer) var pickedImage: UIImage = UIImage(data:

How to copy an image file from iOS Photo Library (ALAssetsLibrary) to the local directory of an App?

余生颓废 提交于 2019-12-21 17:56:28
问题 I can get images from Photo Library through ALAssetsLibrary: void (^assetEnumerator)(ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop){ if([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto]) { // Copy the photo image to the `/Documents` directory of this App here } }; void (^assetGroupEnumerator )(ALAssetsGroup*, BOOL*) = ^(ALAssetsGroup *group, BOOL *stop){ if (group != nil) { [group enumerateAssetsUsingBlock:assetEnumerator]; } }

How to get thumbnail image of video from ALAsset in iOS?

烈酒焚心 提交于 2019-12-21 17:13:58
问题 I want to get thumbnail images of every frame from video and then save this images in Mutable Array of images. I want to use this images to play as a animation. NSURL* assetURL = [self.asset valueForProperty:ALAssetPropertyAssetURL]; NSDictionary* assetOptions = nil; AVAsset* myAsset = [[AVURLAsset alloc] initWithURL:assetURL options:assetOptions]; self.imageGenerator = [AVAssetImageGenerator assetImageGeneratorWithAsset:myAsset]; int duration = CMTimeGetSeconds([myAsset duration]); for(int i

Delete Images From iOS Photo Gallery [duplicate]

笑着哭i 提交于 2019-12-21 16:19:12
问题 This question already has answers here : ALAssetsLibrary delete ALAssetsGroup / ALAsset (6 answers) Closed 5 years ago . I have created an Application that fetches Images from the photo library of the phone and displays it on a collection view. Now, I want that whenever the user selects an image and click on a delete button that particular image gets deleted from the collection view as well as from the image library. I am using ALAssetLibrary to fetch the images. I searched a lot but did not

Delete Images From iOS Photo Gallery [duplicate]

一笑奈何 提交于 2019-12-21 16:19:09
问题 This question already has answers here : ALAssetsLibrary delete ALAssetsGroup / ALAsset (6 answers) Closed 5 years ago . I have created an Application that fetches Images from the photo library of the phone and displays it on a collection view. Now, I want that whenever the user selects an image and click on a delete button that particular image gets deleted from the collection view as well as from the image library. I am using ALAssetLibrary to fetch the images. I searched a lot but did not

How do i get only the videos using ALAssetsLibrary

大城市里の小女人 提交于 2019-12-21 11:04:32
问题 I am trying to get videos present from the photo library from the following piece of code.But i also get images list.How do i get list of all videos? what am i doing wrong? NSMutableArray* assetURLDictionaries = [[NSMutableArray alloc] init]; xy =[[NSMutableArray alloc]init]; ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; void (^assetEnumerator)( ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) { if(result != nil) { if([[result valueForProperty

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

一曲冷凌霜 提交于 2019-12-21 06:39:10
问题 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 回答1: Try these methods... -(void)loadNewLibraryImages { self

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

强颜欢笑 提交于 2019-12-21 06:28:09
问题 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

Has anyone experienced crashes when using ALAssetsLibrary in a background thread?

徘徊边缘 提交于 2019-12-21 04:13:44
问题 I have an ios app which has not crashed in this way on ios 5 which is now crashing consistently on ios 6 on startup after 4 or 5 bg/fg cycles. I've traced the issue to my invocations of ALAssetsLibrary enumerateGroupsWithTypes (the app syncs to the underlying photo library whenever it starts up). The calls to enumerateGroupsWithTypes are made from within a background thread invoked via the dispatch queue so that the sync code can finish even if the user sends the app to the bg before it

iOS photo permissions to ask for second time

笑着哭i 提交于 2019-12-19 10:51:03
问题 I am currently using alasset which asks for permission for first time. If want to pop permission second time or every time when user has blocked it, how it is possible. 回答1: That dialog isn't controlled by the app, so no API for that. You can reset things as a user in the settings app (IIRC) but no programmatic way. To get the current authorization status: [ALAssetsLibrary authorizationStatus]; (+ (ALAuthorizationStatus)authorizationStatus) Also, methods to get assets taking access error