in my Code below,
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *localPath = [[paths objectAtIndex: 0] stringByAppendingPathComponent: @"temporary.png"];
NSLog(@"local path=%@", localPath);
[UIImagePNGRepresentation(self.scriptPicture.image) writeToFile:localPath atomically:YES];
//[opData.scripts writeToFile:localPath atomically:YES];
if ([[NSFileManager defaultManager] fileExistsAtPath:localPath]) {
NSLog(@"file is exist");
NSURL *fileurl=[NSURL URLWithString:localPath];
CKAsset *myfile=[[CKAsset alloc] initWithFileURL:fileurl];
//postRecrod[@"scriptPicture"]=myfile;
[postRecrod setObject:myfile forKey:@"scriptPicture"];
}
error will occur in the line of "CKAsset *myfile=[[CKAsset alloc] initWithFileURL:fileurl];
"
error message is below:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Non-file URL'
I don't know how to solve this and search web all night long, but no help. Please help me ! I am a code beginner !