TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jun 2015 |
Maintained by Eugene Nguyen.
Depends on: | |
XBCacheRequest | >= 0 |
JSONKit-NoWarning | >= 0 |
MD5Digest | >= 0 |
SDWebImage | >= 0 |
Facebook-iOS-SDK | >= 0 |
XBLanguage | >= 0 |
To run the example project, clone the repo, and run pod install
from the Example directory first.
XBAuthentication provide all the function refer to user system, include sign in, sign up, sign out, edit user's information, delete account. This is core system of XBMobile.
First, import XBAuthentication.h every where you need
Second, setup your web service domain.
[[XBAuthentication sharedInstance] setHost:@"http://example.com"];
Then, set the field that you want.
XBAuthentication *authenticator = [XBAuthentication sharedInstance];
authenticator.username = @"username";
authenticator.password = @"password";
And lastly, sign in or sign up as you wish.
[authenticator signup];
// OR, remember, OR, not AND
[authenticator signin];
You can use following function for your next step
// Forgot password (with username or email)
- (void)forgotPasswordForUser:(NSString *)user complete:(XBARequestCompletion)completion;
// Change password (with old / new password)
- (void)changePasswordFrom:(NSString *)oldPassword to:(NSString *)newPassword complete:(XBARequestCompletion)completion;
// save / load session, using for remember me function
- (void)saveSession;
- (void)loadSession;
And last super good news, from now, you can login with facebook using XBAuthentication. with very simple following steps:
In AppDelegate file, add following code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
return [[XBAuthentication sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];;
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[[XBAuthentication sharedInstance] applicationDidBecomeActive:application];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [[XBAuthentication sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}
And notice the log. it will remind you about what setting you missed in Info.plist. Just fill all the information as requested. And now, when you ready to get user login, using:
[[XBAuthentication sharedInstance] startLoginFacebookWithCompletion:^(NSString *responseString, id object, int errorCode, NSString *description, NSError *error) {
... do anything that you want with responseString, object (response object), errorCode, description and error. all in your hand now.
}];
eugenenguyen, [email protected]
XBAuthentication is available under the MIT license. See the LICENSE file for more info.