I have an iPhone app that uses sync services to sync its data with the desktop version, everything is working fine, except for the images.
On the iphone I store an image in the Documents Directory and the path to the file in core data. I set up a transient attribute "image" and checked the sync check box and assigned it as an identity property. I added two methods,
- (NSData *)image;
{
NSLog(@"%@:%s entered", [self class], _cmd);
if (image) return image;
NSString *path = [self primitiveValueForKey:@"pathToFile"];
if (!path) return nil;
NSString *myPath = [NSHomeDirectory() stringByAppendingPathComponent:path];
image = [[NSData alloc] initWithContentsOfFile:myPath];
return image;
}
- (void)setImage:(NSData *)data
{
NSLog(@"%@:%s entered", [self class], _cmd);
NSString *destPath = [self primitiveValueForKey:@"pathToFile"];
if (!destPath) {
//Build the path we want the file to be at
destPath = NSHomeDirectory();
NSString *guid = [[NSProcessInfo processInfo] globallyUniqueString];
NSString *fpath = [NSString stringWithFormat:@"Documents/%@", guid];
destPath = [destPath stringByAppendingPathComponent:fpath];
[self setValue:destPath forKey:@"pathToFile"];
}
[data writeToFile:destPath atomically:NO];
[data retain];
[image release];
image = data;
}
- (void)willTurnIntoFault
{
[image release], image = nil;
}
I thought that, because I added the image attribute in the client description file, it would just put the data in the store file that is sent to ZSync daemon, but I am wrong. And the image data is not transferred
My question is can this be done? or What is the best way to sync image data?
please give me guidance, I have searched and searched but no luck finding any solutions.
thank you