phasset

How to get Original Image and media type from PHAsset?

时光总嘲笑我的痴心妄想 提交于 2019-12-19 08:29:47
问题 My **GMImagePickerController** returns the list of selected images from photos app. The code are as follows. - (void)assetsPickerController:(GMImagePickerController *)picker didFinishPickingAssets:(NSArray *)assetArray { NSLog(@"%@",assetArray); NSLog(@"GMImagePicker: User ended picking assets. Number of selected items is: %lu", (unsigned long)assetArray.count); } The assetArray return result like this, I selected 3 images from photos app ( "<PHAsset: 0x7fa39e02e840> 1AEEF04A-F8AB-4019-AAB5-

How to get Original Image and media type from PHAsset?

这一生的挚爱 提交于 2019-12-19 08:29:07
问题 My **GMImagePickerController** returns the list of selected images from photos app. The code are as follows. - (void)assetsPickerController:(GMImagePickerController *)picker didFinishPickingAssets:(NSArray *)assetArray { NSLog(@"%@",assetArray); NSLog(@"GMImagePicker: User ended picking assets. Number of selected items is: %lu", (unsigned long)assetArray.count); } The assetArray return result like this, I selected 3 images from photos app ( "<PHAsset: 0x7fa39e02e840> 1AEEF04A-F8AB-4019-AAB5-

PHAsset + AFNetworking. Unable to upload files to the server on a real device

喜你入骨 提交于 2019-12-18 13:58:30
问题 Currently I'm using the following code to upload files to the server NSURLRequest *urlRequest = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:[[entity uploadUrl]absoluteString] parameters:entity.params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { // Get file url [UploadModel getAassetUrl:entity.asset resultHandler:^(NSURL *fileUrl) { NSError *fileappenderror; // Append [formData appendPartWithFileURL:fileUrl name:@"data" error:

How do I determine if a PHAsset in a PHFetchResult represents a deleted photo?

萝らか妹 提交于 2019-12-18 11:57:14
问题 I'm trying to grab a thumbnail of the last photo taken on a device using the new Photos framework in iOS 8. The code I have right now to do this is the following: PHFetchOptions *fetchOptions = [PHFetchOptions new]; fetchOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]]; PHFetchResult *assetsInfo = [PHAsset fetchAssetsWithOptions:fetchOptions]; PHImageRequestOptions *requestOptions = [PHImageRequestOptions new]; requestOptions.version =

Connection to assetsd was interrupted or assetsd died

Deadly 提交于 2019-12-18 11:27:48
问题 I load photos from PHAssets. I get this error log when I load some images and pass them to another view controller. I can't seem to find anything online about this. Anyone encounter this and know what it is? I also get this error along with it: ***** Error: logging directory does not exist /var/mobile/Library/Logs/CrashReporter/DiagnosticLogs/ 回答1: There may be following reason : 1.) It may occur when we try to use multiple Image view (Image) so just image and try to release it , it will

How to fetch images from photo library within range of two dates in iOS?

痞子三分冷 提交于 2019-12-17 20:29:44
问题 Context I am try to fetch images within range of two dates from the photo library. Firstly, I am getting info of the photo library images one by one in the dictionary form and picking every image date by using key and comparing that date with two dates by using if condition. If that image's date lies between the two dates, I insert that image into array. I am Saving images in array because I would like to show them in a collection view. Problem While it is working on simulator, it is not

How to use PHCachingImageManager

人走茶凉 提交于 2019-12-17 19:07:33
问题 I know that there is already this question on SO, but I don't think that the given answer is satisfying/complete: How can IOS Photos app can show hundreds of photos in one screen? What I want to achieve I want something like the image selection in whatsapp (iOS) (see screenshot). When you open the camera, there is also a horizontal slider where you can see all images from your gallery. What I tried Right now I have the following code in my appDelegate: let options = PHFetchOptions() options

Save images with phimagemanager to custom album?

非 Y 不嫁゛ 提交于 2019-12-17 05:40:43
问题 I am making an app that takes pictures with AVFoundation and I want to save them to a custom album that I can then query and show in my app. (I'd prefer to not have them in the general photo roll, unless the user wants that) I can't really find anything showing how to do this in Swift... or at all. Is there a different way I am supposed to do this? I found this example on SO but it doesn't make sense to me and I can't get it to work. func savePhoto() { var albumFound : Bool = false var

How to add pagination to PHAsset fetching from Photos Framework?

前提是你 提交于 2019-12-14 03:59:18
问题 I am trying to get all the photos from cameraRoll using Photos framework but its taking a lot of time to fetch all the photos from cameraRoll. Is their anyway to add pagination to it ? so i can fetch while scrolling. var images = [UIImage]() var assets = [PHAsset]() fileprivate func assetsFetchOptions() -> PHFetchOptions { let fetchOptions = PHFetchOptions() //fetchOptions.fetchLimit = 40 //uncomment to limit photo let sortDescriptor = NSSortDescriptor(key: "creationDate", ascending: false)

PHAsset assetResourcesForAsset fails when called too often

白昼怎懂夜的黑 提交于 2019-12-13 06:10:52
问题 I need to retrieve the names of all the PHAsset existing in the Camera Roll, individually and in a short time. To get the file name, I use the documented originalFilename property of PHAssetResource associated to the PHAsset . This works fine for the first assets, but at some point (after around 400 assets), it starts failing and returning nil every time. Here is a code that shows this behavior (running on an iPhone 7 with ~800 photos in the Camera Roll): PHFetchResult *result =