UIImage *image = [UIImage imageNamed:@"bg.png"];
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetCreationRequest *request = [PHAssetCreationRequest creationRequestForAsset];
[request addResourceWithType:PHAssetResourceTypePhoto
data:imageData
options:nil];
} completionHandler:^(BOOL success, NSError *error) {
NSLog(@"");
}];This code works well with iOS 8.x. But its fails with error code -1 in iOS 9.x.
The error is NSCocoaErrorDomain Code=-1
ERROR: PLXPCDictionarySetArray unable to serialize array (
{
creationOptions = "<null>";
data = <ffd8ffe0 ………>;
fileURL = "<null>";
type = 1;
}
) error Error Domain=NSCocoaErrorDomain Code=3851 "Property list invalid for format: 200 (property lists cannot contain objects of type 'CFNull')" UserInfo={NSDebugDescription=Property list invalid for format: 200 (property lists cannot contain objects of type 'CFNull')}
Any idea about this behaviour in iOS 9..? Any help is appreciated ! Thanks🙂