在我下面的代码中,
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"];
}
错误将出现在“ CKAsset *myfile=[[CKAsset alloc] initWithFileURL:fileurl];
”行,错误信息如下:
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“非文件 URL”
我不知道如何解决这个问题并整夜搜索网络,但没有帮助。请帮我 !我是代码初学者!