0

I've managed to save LBUser to my mongodb that's running on a server, but I wasn't able to save a class that inherits from LBUser, I just want to know if someone managed to extend LBUser or if it is really something not possible to do right now with the loopback SDK for iOS.

C. Porto
  • 631
  • 3
  • 12
  • 26

1 Answers1

0

When you say LBUser, do you mean extending the built-in User model? We have a an example of extending models here: http://docs.strongloop.com/display/LB/Extending+models

tl;dr, if you created your app via slc loopback and your model via slc loopback:model user, you can modify common/models/user.json and replace the value in the base property (which is PersistedModel) with User. I have an example here: https://github.com/strongloop/loopback-example-access-control/blob/master/common/models/user.json#L3

  • Thanks for the answer, unfortunately, I already know and tried this approach (extending User in the .json), the thing is, back at the Loopback iOS SDK, I can't save the extended user, i.e. using `createUserWithEmail`, for example, I created an LBUser instance and casted to my class which extended LBUser, but then when `saveWithSuccess` was called, an error related to HTTP Post appeared. Here's the question in which I specifically asked that, and I also present some code [Strongloop iOS LBUser Extension Error 422 in Post](http://example.com) – C. Porto Oct 23 '14 at 10:54
  • The comment above links to a page that takes you to example.com. Here is the correct link: http://stackoverflow.com/questions/26360614/strongloop-ios-lbuser-extension-error-422-in-post – Rob Evans Nov 01 '14 at 11:15