Start a new topic
Answered

User saveWithCompletionBlock failed

I am trying to update the user after it has been saved. For example:


 KCSUser.activeUser().givenName = "hello"

 KCSUser.activeUser().saveWithCompletionBlock({

 (user, error) -> Void in

       NSLog("HERE")

 })


Before printing "HERE" the application crashes with an error message 

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (__NSSetM)'


I am using iOS 9.2 on the iPad mini with Kinvey 1.40.3.


Thank you


Best Answer
Jonathan,

Can you try with the latest KinveyKit SDK (1.40.7) version? URL for downloading the latest SDK as following:

http://devcenter.kinvey.com/ios/downloads#


I tried with the below code and it successfully updated the “first_name” field in the ‘user' collection for the active user.

Relevant code below:

 

    KCSUser.activeUser().givenName = "hellotest"
       
        user.saveWithCompletionBlock {
            (objectsOrNil: [AnyObject]!, errorOrNil: NSError!) -> Void in
            if errorOrNil == nil {
                NSLog("successfully saved user object: %@", objectsOrNil)
               
            } else {
                NSLog("error occurred: %@", errorOrNil)
            }
        }

 


Thanks,
Pranav
Kinvey Support

 

1 Comment

Answer
Jonathan,

Can you try with the latest KinveyKit SDK (1.40.7) version? URL for downloading the latest SDK as following:

http://devcenter.kinvey.com/ios/downloads#


I tried with the below code and it successfully updated the “first_name” field in the ‘user' collection for the active user.

Relevant code below:

 

    KCSUser.activeUser().givenName = "hellotest"
       
        user.saveWithCompletionBlock {
            (objectsOrNil: [AnyObject]!, errorOrNil: NSError!) -> Void in
            if errorOrNil == nil {
                NSLog("successfully saved user object: %@", objectsOrNil)
               
            } else {
                NSLog("error occurred: %@", errorOrNil)
            }
        }

 


Thanks,
Pranav
Kinvey Support

 

Login or Signup to post a comment