This question is locked. New answers and comments are not allowed.
Hi,
I have added a few extra fields to the build-in Users data type and am trying to add sign up/in to my app, using swift. I have created a custom class, that inherits from EVUser:
The problems start when I try to sign up a new user, using my custom user class:
I get the following error:
In the screenshot is the request, that is sent to the server - the fields (password, email etc.) are not set at all. When I send the same request, but I initialize newUser as an EVUser, everything works fine, as seen in the second screenshot.
I have added a few extra fields to the build-in Users data type and am trying to add sign up/in to my app, using swift. I have created a custom class, that inherits from EVUser:
@
interface
My
User : EVUser
@property (strong, nonatomic) NSString* motherTongue;
@end
The problems start when I try to sign up a new user, using my custom user class:
var newUser = MyUser()
newUser.password =
"password"
newUser.username =
"user"
newUser.email =
"user@example.com"
newUser.signUp({ (user: EVUser!, error: NSError!) -> Void
in
if
(error == nil) {
println("user created successfully)
}
else
{
println(
"ERROR IN SIGN UP: \(error)"
)
}
})
I get the following error:
{
"message"
:
"Invalid request body."
,
"errorCode"
: 615
}
In the screenshot is the request, that is sent to the server - the fields (password, email etc.) are not set at all. When I send the same request, but I initialize newUser as an EVUser, everything works fine, as seen in the second screenshot.
7 Answers, 1 is accepted
0
Hello Ivaylo,
You said that you are using Swift to build your app. So I took the signup code snippet that you posted and used the following class definition for MyUser:
When I tried it this way, the user was successfully registered in the backend services and the motherTongue property was properly set as an additional field.
Would you please elaborate a bit more on the problem and I am sorry if I misunderstood you.
I am looking forward to your reply.
Regards,
Dimitar Dimitrov
Telerik
You said that you are using Swift to build your app. So I took the signup code snippet that you posted and used the following class definition for MyUser:
class
MyUser : EVUser {
var motherTongue : String =
""
}
When I tried it this way, the user was successfully registered in the backend services and the motherTongue property was properly set as an additional field.
Would you please elaborate a bit more on the problem and I am sorry if I misunderstood you.
I am looking forward to your reply.
Regards,
Dimitar Dimitrov
Telerik
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
0
smeshko
Top achievements
Rank 1
answered on 11 Mar 2015, 07:57 PM
Hi Dimitar,
yes, I am using Swift, but in an answer to a different question, a colleague of yours told me to create my Model classes in Objective C, due to some problems with server-side property mapping. I assume that the problem is resolved and I can use Swift for my Models from now on.
But anyway, even creating my Model as a Swift class didn't resolve the issue. The motherTongue property gets set, but the others don't. I've attached a screenshot of the request that gets sent.
yes, I am using Swift, but in an answer to a different question, a colleague of yours told me to create my Model classes in Objective C, due to some problems with server-side property mapping. I assume that the problem is resolved and I can use Swift for my Models from now on.
But anyway, even creating my Model as a Swift class didn't resolve the issue. The motherTongue property gets set, but the others don't. I've attached a screenshot of the request that gets sent.
0
I'll sync the information about the properties mapping with my colleague tomorrow.
Otherwise, here is the exact code snippet that I'm using and the result record in the backend has all of the following properties set:
And the MyUser class is the same as the previous post:
I am attaching a screenshot of the result.
Regards,
Dimitar Dimitrov
Telerik
Otherwise, here is the exact code snippet that I'm using and the result record in the backend has all of the following properties set:
var newUser = MyUser()
newUser.password =
"password"
newUser.username =
"user6"
newUser.email =
"user6@example.com"
newUser.displayName =
"user6"
newUser.motherLanguage =
"bulgarian"
newUser.signUp({ (user: EVUser!, error: NSError!) -> Void
in
if
(error == nil) {
NSLog(
"no error occurred"
)
}
else
{
NSLog(
"error occurred"
)
}
})
And the MyUser class is the same as the previous post:
class
MyUser : EVUser {
var motherLanguage : String =
""
}
I am attaching a screenshot of the result.
Regards,
Dimitar Dimitrov
Telerik
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
0
smeshko
Top achievements
Rank 1
answered on 11 Mar 2015, 11:22 PM
Hi Dimitar,
I tried your code, but I still get the same result. I also tried creating a new project and ran the code there with no success. For some reason the original EVUser properties (password, username etc.) are properly set (newUser has all the properties set before the signUp function is called) but not sent to the server and I can't figure out why. Is there anything else I can try ?
I tried your code, but I still get the same result. I also tried creating a new project and ran the code there with no success. For some reason the original EVUser properties (password, username etc.) are properly set (newUser has all the properties set before the signUp function is called) but not sent to the server and I can't figure out why. Is there anything else I can try ?
0
Hi,
I had our interactive push sample project open and tried the behaviour there on two different machines and it is working as expected. I am attaching you my source files ( i have cleaned the push functionality from the project). Would you please give it a try and tell me if the problem still exists.
In the meantime, I'll discuss the problem with my colleagues and see if there is any possible reason for this unexpected behaviour.
I'm waiting for your reply.
Regards,
Dimitar Dimitrov
Telerik
I had our interactive push sample project open and tried the behaviour there on two different machines and it is working as expected. I am attaching you my source files ( i have cleaned the push functionality from the project). Would you please give it a try and tell me if the problem still exists.
In the meantime, I'll discuss the problem with my colleagues and see if there is any possible reason for this unexpected behaviour.
I'm waiting for your reply.
Regards,
Dimitar Dimitrov
Telerik
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
0
smeshko
Top achievements
Rank 1
answered on 12 Mar 2015, 08:25 AM
Hi Dimitar,
thank you for the efforts, the sample project works fine. I've put my API Key and users are created as expected and all the fields are properly set in the request.
I changed the SDK in my project with the one from your sample project and now users are signed up properly. I guess I was using a different/old/corrupted version of the SDK.
Thank you again for all the help !
Regards,
Ivaylo
thank you for the efforts, the sample project works fine. I've put my API Key and users are created as expected and all the fields are properly set in the request.
I changed the SDK in my project with the one from your sample project and now users are signed up properly. I guess I was using a different/old/corrupted version of the SDK.
Thank you again for all the help !
Regards,
Ivaylo
0
Hi Ivaylo,
I am glad that we've managed to resolve the issue.
Do not hesitate to open another thread, if you find another problem.
Regards,
Dimitar Dimitrov
Telerik
I am glad that we've managed to resolve the issue.
Do not hesitate to open another thread, if you find another problem.
Regards,
Dimitar Dimitrov
Telerik
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.