Installing the iOS SDK
The easiest way is to use CocoPods. Add this to your Podfile to obtain the latest beta version (1.18.15266.2) of the api:
pod 'mozu-ios-sdk', :git => 'https://github.com/Mozu/mozu-ios-sdk.git'
Run:
pod update
Authenticate Your App
Obtain your authentication host, app secret and shared secret from the developer portal. Add this to your app:
MOZUAppAuthInfo *appAuthInfo = [MOZUAppAuthInfo new]; appAuthInfo.ApplicationId = <YOUR APP ID> appAuthInfo.SharedSecret = <YOUR SHARED SECRET> NSString *authenticationHost = <YOUR AUTHENTICATION HOST DOMAIN> [[MOZUAppAuthenticator sharedAppAuthenticator] authenticateWithAuthInfo:appAuthInfo appHost:authenticationHost useSSL:YES refeshInterval:nil completionHandler:^(NSHTTPURLResponse *response, MOZUAPIError *error) { }];
Authenticate Your User
Prompt user for username (i.e. email address) and password. Add this to your app:
MOZUUserAuthInfo *userAuthInfo = [MOZUUserAuthInfo new]; userAuthInfo.emailAddress = emailAddress; userAuthInfo.password = password; [[MOZUUserAuthenticator sharedUserAuthenticator] authenticateWithUserAuthInfo:userAuthInfo scope:MOZUTenantAuthenticationScope identifier:nil completionHandler:^(MOZUAuthenticationProfile *profile, NSHTTPURLResponse *response, MOZUAPIError *error) { }];