0

I'm working for updating one of my app to use iCloud. all works perfectly, except for images. till now I saved the file path of the image in that way:

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];

I think that to synchronize images between devices I have to save images to the ubiquitary container, but I can't figure out how to get the path and ho to save there. somebody could help me?

Totka
  • 627
  • 6
  • 24
  • What's the size of your images? Maybe it'd be enough to just follow [this advice](http://stackoverflow.com/questions/2573072/coredata-store-images-to-db-or-not/2573113#2573113) ? – Arek Holko Oct 04 '13 at 10:31
  • I know that advice, but what I need is how to upload an image to iCloud – Totka Oct 04 '13 at 13:13
  • What I meant is that if your images are smaller than 1 MB, then you could simply store them directly in Core Data. – Arek Holko Oct 04 '13 at 13:22
  • images are added from the user for every entity – Totka Oct 04 '13 at 13:25

0 Answers0