Closed bosspopuli closed 9 years ago
What's ur lib version used? Have u add reference of Photos.framework
? Plz take a look at this issue (https://github.com/Kjuly/ALAssetsLibrary-CustomPhotoAlbum/issues/16) first, maybe will helps.
Yes i import Photos.framework. and i use the last versión. The code allways pass for this else
else {
// code that always creates an album on iOS 7.x.x but fails
// in certain situations such as if album has been deleted
// previously on iOS 8.x.
[self addAssetsGroupAlbumWithName:albumName
resultBlock:addPhotoToLibraryBlock
failureBlock:failure];
}
Seems u cannot get the PHPhotoLibrary
class, can confirm it?
Class PHPhotoLibrary_class = NSClassFromString(@"PHPhotoLibrary");
if (PHPhotoLibrary_class) {
...
} else {
// code that always creates an album on iOS 7.x.x but fails
// in certain situations such as if album has been deleted
// previously on iOS 8.x.
[self addAssetsGroupAlbumWithName:albumName
resultBlock:addPhotoToLibraryBlock
failureBlock:failure];
}
Wait, u're testing the demo project? Seems the demo project has not imported the framework yet.
The demo project work fine. In my project in a last version worked fine but now don´t work.
This in your class
#import "ALAssetsLibrary+CustomPhotoAlbum.h"
#import <Photos/PHPhotoLibrary.h>
This in my class
-(void)photo{
UIImage *image = [ImageGenerator imageWithView:self.view];
NSDateFormatter * dateFormatter = [NSDateFormatter new];
[dateFormatter setDateFormat:@"YYYYMMDD"];
_namePhoto = [dateFormatter stringFromDate:[NSDate date]];
[ImageGenerator saveImage:image name:_namePhoto];
[self.library saveImage:image toAlbum:self.sessionData.merchant.merchantName completion:^(NSURL *assetURL, NSError *error) {
if (error)
DLog(@"ERROR SAVE ALBUM");
[self performSelectorOnMainThread:@selector(endPhoto) withObject:nil waitUntilDone:YES];
} failure:^(NSError *error) {
DLog(@"FAILURE SAVE ALBUM");
[self performSelectorOnMainThread:@selector(endPhoto) withObject:nil waitUntilDone:YES];
}];
}
Allways return "failure save album" and not recognize PHPhotoLibrary...
This Image is saved in the camera roll
Generally, the failure
block will be invoked if user denied ur app to access to the assets library. Plz make sure ur app is allowed to access the photos app in Settings.app after u upgraded ur system version.
Seems u want to change the name for photo, then save it to album. Plz comment out the code snippet below to avoid other factors before do testing first.
NSDateFormatter * dateFormatter = [NSDateFormatter new];
[dateFormatter setDateFormat:@"YYYYMMDD"];
_namePhoto = [dateFormatter stringFromDate:[NSDate date]];
[ImageGenerator saveImage:image name:_namePhoto];
Check the value of image
& self.sessionData.merchant.merchantName
, make sure they're the one u want.
In the Navigation project appear the Photos.framework but not in the target. I add the framework again and it works!!! Really thanks! When the xcode updated, it removed my framework...
Thanks again!
Haha, cool!
Anyone know if the iOS 8.3 has become the problem of storing photos in album a deleted before?
I have this nserror:
EDIT: i modify the code with example and now i have this error: