3

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.

ash
  • 101
  • 1
  • 7

1 Answers1

1

Are you trying to associate the profile photo with the user? http://support.kinvey.com/hc/communities/public/questions/200341553-Link-users-to-file-uploads?locale=en-us

Does this help answer your question?

Caroline

  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – LittleBobbyTables - Au Revoir Nov 04 '13 at 19:30
  • Then one have to download this file every time it is needed. The main problem is extending KCSUser collection in the best way. – ash Nov 04 '13 at 21:16