Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何使用带MagicalRecord的CoreData将图像保存到iCloud_Ios_Core Data_Icloud_Magicalrecord_Save Image - Fatal编程技术网

Ios 如何使用带MagicalRecord的CoreData将图像保存到iCloud

Ios 如何使用带MagicalRecord的CoreData将图像保存到iCloud,ios,core-data,icloud,magicalrecord,save-image,Ios,Core Data,Icloud,Magicalrecord,Save Image,我正在更新我的一个应用程序以使用iCloud。除了图像之外,所有的工作都很完美。到目前为止,我以这种方式保存了图像的文件路径: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0];

我正在更新我的一个应用程序以使用iCloud。除了图像之外,所有的工作都很完美。到目前为止,我以这种方式保存了图像的文件路径:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
                NSString *documentsDirectory = [paths objectAtIndex:0];

                NSString*imageName = [[NSString alloc] initWithFormat:@"%@", self.fieldNome.text];
                NSString *pngFilePath = [NSString stringWithFormat:@"%@/%@.png",documentsDirectory, imageName];
                UIImage *image = self.myImageView.image; 
                NSData *data1 = [NSData dataWithData:UIImagePNGRepresentation(image)];
                [data1 writeToFile:pngFilePath atomically:NO];

我认为,要在设备之间同步图像,我必须将图像保存到泛素容器中,但我不知道如何获取路径和保存路径。有人能帮我吗?

你的照片有多大?我知道这个建议,但我需要的是如何将图像上传到iCloud。我的意思是,如果您的图像小于1MB,那么您可以直接将其存储在核心数据中。每个实体的图像都由用户添加