I wanted to add a profile photo to user collection when creating a user. I was thinking of doing [user setValue:imageData forAttribute:@"photo"]
and then with help of KCSLinkedAppdataStore
store it. But it fails with error JSON serialization not supported for NSConcreteMutableData.
[user setValue:imageData forAttribute:@"photo"];
KCSLinkedAppdataStore* store = [KCSLinkedAppdataStore storeWithCollection:[KCSCollection userCollection] options:nil];
[store saveObject:user withCompletionBlock:^(NSArray *objectsOrNil, NSError *errorOrNil) {
if (errorOrNil == nil) {
//was successful!
} else {
//failed
}
} withProgressBlock:nil];
Uploading the file separately and then set its fileid
to an attribute in user collection works. What is the best way of extending KCSUser
? I am currently using class extension.