• SDK requirements

    - Minimum iOS target - iOS 7
    - Minimum OS X target - OS X 10.9
    - Xcode 7 or later version is required

  • SDK structure

    SDK consists of 10 main folders: one of them is mandatory and others are optional. Check detailed descriptions for all folders below.


    1) Mandatory folder

      - BaseSDK - this folder is included to SDK by default. It deals with internet connection, users' sessions, base models, base responses' parsing and other commonly used things.

    You may read more about adding this folder here


    2) Optional folders

      - AccountSDK - this folder contains classes which are designed to make calls to the Account service. All service's methods can be accessed using AccountSDK class

      - AppIdentitySDK - this folder contains classes which are designed to make calls to the AppIdentity service. All service's methods can be accessed using AppIdentitySDK class

      - BalanceSDK - this folder contains classes which are designed to make calls to the Balance service. All service's methods can be accessed using BalanceSDK class

      - CustomerSDK - this folder contains classes which are designed to make calls to the Customer service. All service's methods are divided by groups depending on their purposes. Methods which deal with customer data can be accessed using CustomerSDKCustomers class, methods which deal with friends can be accessed using CustomerSDKFriends class and methods which deal with user's shipping addresses can be accessed using CustomerSDKShippingAddresses class

      - InternationalSDK - this folder contains classes which are designed to make calls to the International service. All service's methods can be accessed using InternationalSDK class

      - MerchantSDK - this folder contains classes which are designed to make calls to the Merchant service. All service's methods can be accessed using MerchantSDK class

      - PaymentMethodsSDK - this folder contains classes which are designed to make calls to the PaymentMethods service. All service's methods can be accessed using PaymentMethodsSDK class

      - ShopSDK - this folder contains classes which are designed to make calls to the Shop service. All service's methods are divided by groups depending on their purposes. Methods which deal with carts can be accessed using ShopSDKCarts class, methods which deal with downloads can be accessed using ShopSDKDownloads class, methods which deal with merchants can be accessed using ShopSDKMerchants class, methods which deal with products can be accessed using ShopSDKProducts class and methods which deal with shops can be accessed using ShopSDKShops class

      - TransactionsSDK - this folder contains classes which are designed to make calls to the Transactions service. All service's methods can be accessed using TransactionsSDK class

    You may read more about adding these folders here

  • Adding Coriunder SDK to your project

    1) Pull Coriunder base project. That is the base for any Coriunder SDK you are going to use. It contains commonly used methods and helps SDKs to communicate with each other.

    2) Drag Coriunder folder to your project.

    Dragging Coriunder folder image

    After this a dialog will appear. In this dialog mark "Copy items if needed" and "Create groups" lines and choose the target to add new files to as it is done on the picture below and press Finish.

    Drag'n'drop dialog

    Now Coriunder SDK is successfully imported to your project.

  • Prepare SDK for your needs

    Coriunder SDK is flexible: it allows you to use only those parts which you really need. Just download SDK parts you need and add them to the Coriunder folder. Here is a more detailed instruction on how to do that.

    1) Now you already have a folder called Coriunder with BaseSDK folder in it.

    iOS project structure at this step

    2) Download the folder with the SDK part you need and drag it to the Coriunder folder

    Dragging to Coriunder folder image

    After this a dialog will appear. In this dialog mark "Copy items if needed" and "Create groups" lines and choose the target to add new files to as it is done on the picture below and press Finish.

    Drag'n'drop dialog

    The result will look like this

    iOS project structure at this step

    Add all SDK parts you need this way to use them with your app.

    NOTE: you should add Coriunder base to your project only once. All SDK parts for the project should be pasted to the same Coriunder folder

    iOS project structure at this step
  • Prepare your application

    Go to Coriunder/BaseSDK/CoriunderSetup.plist file and set mandatory parameters there:

      a) serviceURL - this is your server URL which leads to your services location, but doesn't specify exact service. It should look like "http://yourdomain.com/v2/". Depending on the service you call the last part of the URL is being added automatically by the SDK (Customer.svc, Shop.svc, etc). In case later you'll need to change the URL dynamically in your app, you may call setServiceUrl method

    Note: if the connection will use HTTP, be sure to add these lines to your Info.plist file:

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>

      b) appToken - this is your application token, which should be generated in your services' admin panel. It is automatically added to requests' headers or bodies when required. In case later you'll need to change the application token dynamically in your app, you may call setAppToken method

      c) salt - this is salt, which is being used when requests' signatures are being created. It should be generated in your services' admin panel for the specified application token

    Other features

    1) To enable or disable logging requests and responses in the log panel go to Coriunder/BaseSDK/CoriunderSetup.plist and set corresponding value to the enableLogs variable

    2) In case user's session expires or any method which requires user to be logged in is being accessed when nobody is logged in, a notification called "coriunderSessionInvalid" is being posted with NSNotificationCenter. So to be notified about session expiration register with a notification center to receive these notifications.

    // Do required stuff to handle the event in the sessionIsInvalid method
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(sessionIsInvalid)
                                                 name:@"coriunderSessionInvalid"
                                               object:nil];
  • Using the SDK

    To use Coriunder SDK just call the required method of the corresponding SDK part. Last parameter is usually a callback, which returns full info about the request's result.

    Example:
    [[AccountSDK getInstance] setNewPassword:@"newPassword"
                              oldPassword:@"yourOldPassword"
                                 callback:^(BOOL success, ServiceResult *result, NSString *message) {
                                     if (success) {
                                         // do your stuff here
                                     } else {
                                         // do your stuff here
                                     }
    }];