в моем коде ниже,Xcode: CKAsset в CloudKit
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 '
Я не знаю, как решить эту проблему arch web всю ночь напролет, но никакой помощи. Пожалуйста, помогите мне! Я начинающий код!