The NUWE Core iOS SDK is designed to make working with the NUWE REST API as easy and complete as possible.
At its heart is the
NUCore class. This class is responsible for things mainly related to the
NUUser object, our app user.
We have a couple of class methods here.
+ (NUCore *) client; is a staticInstance with initialises our NUCore class.
+ (NUUser *) getCurrentUser will return to us our
NUCore client's currentUser, if available.
It can be used like this:
NUCore client] gives us an API for some helpful authentication and registration features, our app will most likely need.
- (BOOL) signUp - a synchronous way to signup a user in the background. You must set the username and password before calling this method. Returns
YES if successful, otherwise
- (void)signUpInBackgroundWithBlock:(NUBoolResultBlock)block; - an asynchronous request to sign up the user. You must set the username and password before calling this method. The block will return whether a user has been successfully signed up.
+ (NUUser*)logInWithUsername:(NSString *)username password:(NSString *)password;
This synchronous call returns an instance of the
NUUser in success, otherwise it returns
+ (void)logInWithUsernameInBackground:(NSString *)username password:(NSString *)password block:(NUUserResultBlock)block;
This asynchronous call returns block, which should have the following argument signature:
^(NUUser *user, NSError *error)
Note: As of the V3 API, we prefer to use the OAuth Implicit Grant flow, for users to Authorise connection to an existing
NUUseraccount and create a new session. Since this can be a bit more complicated to implement, we have created some UI’s and tutorials to help (will add link once they are posted). Get in touch if you need help in the meantime.
Closing a Session
+ (void)logOut; - This is a synchronous call which will log out the currentUser on disk.
+ (BOOL)requestPasswordResetForEmail:(NSString *)email;
This synchronous method will, if user exists with the given email, trigger an email to be sent to that address with instructions for the user how to reset their password. Returns
YES if the rest email request is successful,
NO if the account was not found.
+ (void)requestPasswordResetForEmailInBackground:(NSString *)email block:(NUBoolResultBlock)block;
This asynchronous method will trigger a password reset email in the background and will respond with a block result of the following argument signature:
^(BOOL succeeded, NSError *error). If user exists with the given email, trigger an email to be sent to that address with instructions for the user how to reset their password