PFIncrementalStore icon indicating copy to clipboard operation
PFIncrementalStore copied to clipboard

PFFile downloading but wont upload.

Open geckom opened this issue 11 years ago • 1 comments

PFFiles are sync'd from parse to local db without a problem. However when a NSData field in the model is created/update the new image is not sync'd back to parse.

Update Error: Error Domain=Parse Code=111 "The operation couldn’t be completed. (Parse error 111.)" UserInfo=0x155ce710 {code=111, error=invalid type for key photo, expected file, but got bytes}

geckom avatar Sep 16 '14 02:09 geckom

The following change to setValuesFromManagedObject will solve the issue for now:

    id value = [managedObject valueForKey:attributeName];
    if (value) {
        if([value isKindOfClass:[NSData class]])
        {
            PFFile *imageFile = [PFFile fileWithData:value];
            [self setValue:imageFile forKey:attributeName];
        } else {
            [self setObject:value forKey:attributeName];
        }
    } else {
        [self removeObjectForKey:attributeName];
    }

geckom avatar Sep 16 '14 03:09 geckom