update user email

hello i’ve been using this code to change the current user email_app, but its not working

    let currentUser = self.backendless?.userService.currentUser

    let properties = [

        "email_app" : "test"

    ]

    currentUser?.updateProperties(properties)

    let updatedUser = self.backendless?.userService.update(currentUser)

Hi,
do you receive any error?

No errors appears but the app crashes when I use this code

that’s the error im getting on xcode (swift3)

2016-09-29 17:12:43.112 ChallengeMe[270:11553] *** Terminating app due to uncaught exception of class ‘Fault’

libc++abi.dylib: terminating with uncaught exception of type Fault

that’s my fonction :

func test()

{

    Types.tryblock({ () -> Void in

        

    let currentUser = self.backendless?.userService.currentUser

    let properties = [

        "email_app" : "test"

    ]

    currentUser?.updateProperties(properties)

    let updatedUser = self.backendless?.userService.update(currentUser)

    print("User updated (SYNC): \(updatedUser)")

        },

                   catchblock: { (exception) -> Void in

                    print("Server reported an error: \(exception)" )

    })

    

}

and that’s the error im getting : Server reported an error: Optional(FAULT = ‘3900’ [User is missing or null] <User is missing or null> )

and i have a user currently logged in with facebook on my application

can u check whats that fault :

Server reported an error: Optional(FAULT = ‘1001’ [Cannot update object without any properties: email_app] <Cannot update object without any properties: email_app> )
?

and thats my new code :

func test()

{

    Types.tryblock({ () -> Void in

        

    let currentUser = self.backendless?.userService.currentUser

    let properties = [

        "email_app" : self.emailTextField.text

    ]

    currentUser?.updateProperties(properties)

    let updatedUser = self.backendless?.userService.update(currentUser)

    print("User updated (SYNC): \(updatedUser)")

        },

                   catchblock: { (exception) -> Void in

                    print("Server reported an error: \(exception)" )

    })

    

}

I’ve contacted with our iOS developer, hope he’ll help you here soon. Thanks for the patience.

You should be logged in to be able to update current user.
Please investigate our sample project (see in attachment). We added your test() func into our sample, and it works for us. Check it with your appId & secretKey, how will it work for you?

TestS3UserUpdate.zip (19.79MB)