alassetslibrary

ALAssetsLibraryWriteVideoCompletionBlock return undefined values

假如想象 提交于 2019-12-10 15:43:20
问题 ALAssetsLibraryWriteVideoCompletionBlock is returning undefined values. If assetURL is equal to nil, then error ought to be not equal to nil, that is, return to me some error description. See apple documentation at here. When I record small video, ALAssetsLibraryWriteVideoCompletionBlock return a good value of assetURL, but when I record long video 3 or 4 Gb, assetURL return nil and error return nil. Video recorded is in tmp file because I can see this video in temporally folder in my app. It

App using UIImagePickerController freezes when selecting “Use Photo” after taking a photo

自古美人都是妖i 提交于 2019-12-10 13:00:45
问题 I'm working on a simple photo and video capture app right now. The app successfully allows the user to take a photo or video on a button press. However, as soon as you finish taking your photo or video, it gives 2 options: "Retake" and "Use Photo" or "Use Video", depending on which one you're using. If the user taps "Retake" then it just let's them retake a new photo or video, but when the user taps "Use photo" or "Use video" the screen freezes. If I exit the frozen app and go look in my

Save Video into Custom Album iOS

我只是一个虾纸丫 提交于 2019-12-10 12:25:04
问题 How to save video with my custom album . I found one link but it don't work Custom file manager It gives the url value is null. [VideoAlbumManager addVideoWithAssetURL:outputFileUrl toAlbumWithName:@"Video Maker"];//outputfileurl is my video url from document directory Give any suggestion for this.. 回答1: You can use this link to save the video.. GitHub Link Import this two files into your project. ALAssetsLibrary+CustomPhotoAlbum.h ALAssetsLibrary+CustomPhotoAlbum.m Then in your save IBAction

Get camera roll images and their EXIF data?

徘徊边缘 提交于 2019-12-10 09:58:56
问题 I figured out how to get all the user's images in the camera roll using the AssestsLibrary: - (void)updateLastPhotoThumbnail { ALAssetsLibrary *assetsLibrary = [[ALAssetsLibrary alloc] init]; [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) { NSInteger numberOfAssets = [group numberOfAssets]; if (numberOfAssets > 0) { NSLog(@"numberOfPictures: %d",numberOfAssets); //NSInteger lastIndex = numberOfAssets - 1; int i = 0; for (i = 0;

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

℡╲_俬逩灬. 提交于 2019-12-09 13:05:13
问题 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? 回答1: For screenshot, its UTI is always a "public.png" and same size as

Orientation does not behave correctly with Photo in ALAsset

此生再无相见时 提交于 2019-12-09 04:20:15
问题 I current have an app that uses ALAsssetsLibrary to fetch the photos. I have placed the photo to an image view and I am able to upload to the server. When I tested on the real device after taking some photos, I found out the photos that supposed to be taken in Portrait become a landscape. Therefore, I called different function to get the CGImage like this: UIImage *image = [UIImage imageWithCGImage:[representation fullResolutionImage] scale:1.0 orientation:(UIImageOrientation)[representation

Getting NSData from an NSURL

时光怂恿深爱的人放手 提交于 2019-12-09 03:27:46
问题 I am trying to upload a photo from my app into a web service. The flow I am attempting to create is as follows: User takes photo with camera Photo is saved to camera roll under a custom album URL of the saved photo is given to my store Store attempts to upload the photo to a web service. I am trying to use NSData *data = [NSData dataWithContentsOfURL:[item assetURL]] where item is a model that contains the URL concerned. But this line is not producing a data when I log it even if it produces

Creation Date from Camera Roll Image

吃可爱长大的小学妹 提交于 2019-12-08 12:46:25
I'm struggling with getting the creation date from an image selected in the camera roll. Here is my code: func imagePickerController(picker: UIImagePickerController!, didFinishPickingMediaWithInfo info:NSDictionary!) { var tmpImg = info[UIImagePickerControllerOriginalImage] as UIImage var metaData: NSDictionary var exifData: NSDictionary let library = ALAssetsLibrary() var dataJpeg: NSData var url: NSURL = info.objectForKey(UIImagePickerControllerReferenceURL) as NSURL library.assetForURL(url, resultBlock: { (asset: ALAsset!) in if asset != nil { var image_representation :

saving image using writeImageDataToSavedPhotosAlbum modifies the actual image data

北城以北 提交于 2019-12-08 12:15:11
问题 I have an image in the camera roll. I get the data representation if the image and md5 check sum it. We write the image to documents directory as img0.jpg Delete the original image and write the data representation back to the camera roll using ALAssetLibrary's writeImageDataToSavedPhotosAlbum. Look in the photo album and the image looks to be the same. Read the newly saved image from the camera roll again. Expected result - mathching md5. Actual result - different md5. Save this file as well

How to edit metadata of image in iOS8?

坚强是说给别人听的谎言 提交于 2019-12-08 08:56:20
问题 ALAssetsLibrary *lib = [[ALAssetsLibrary alloc] init]; [lib assetForURL:nil resultBlock:^(ALAsset *asset) { NSDictionary *metadata = rep.metadata; if (metadata) { NSDictionary *GPSDict=metadata[@"{GPS}"]; NSDictionary *TIFFDict=metadata[@"{TIFF}"]; if (GPSDict){ double longitude = [[GPSDict objectForKey:@"Longitude"] doubleValue]; double latitude = [[GPSDict objectForKey:@"Latitude"] doubleValue]; if ([[GPSDict objectForKey:@"LatitudeRef"] isEqualToString:@"S"]) { latitude = -latitude; } if (