1. Integrate ApigeeiOSSDK.framework

If you've already got an Xcode iOS project, add it into your project as you normally would.

  1. Locate the SDK framework file so you can add it to your project. For example, you'll find the file at the following path:

    <sdk_root>/bin/ApigeeiOSSDK.framework
  2. In the Project Navigator, click on your project file, and then the Build Phases tab. Expand Link Binary With Libraries.
  3. Link the Apigee iOS SDK into your project.
    • Drag ApigeeiOSSDK.framework into the Frameworks group created by Xcode.

    OR

    1. At the bottom of the Link Binary With Libraries group, click the + button. Then click Add Other.
    2. Navigate to the directory that contains ApigeeiOSSDK.framework, and choose the ApigeeiOSSDK.framework folder.

If you're starting with a clean slate (you don't have a project yet), you can begin by using the project template included with the SDK. The template includes support for SDK features.

  1. Locate the project template in the expanded SDK. It should be at the following location:

    <sdk_root>/new-project-template
  2. In the project template directory, open the project file: Apigee App Services iOS Template.xcodeproj.
  3. Get acquainted with the template by looking at its readme file.

2. Add required iOS frameworks

Ensure that the following iOS frameworks are part of your project. To add them, under the Link Binary With Libraries group, click the + button, type the name of the framework you want to add, select the framework found by Xcode, then click Add.

3. Update 'Other Linker Flags'

In the Build Settings panel, add the following under Other Linker Flags:

-ObjC -all_load

Confirm that flags are set for both DEBUG and RELEASE.

4. Initialize the SDK

The ApigeeClient class initializes the App Services SDK. To do this you will need your organization name and application name, which are available in the Getting Started tab of the App Service admin portal, under Mobile SDK Keys.

  1. Import the SDK

    Add the following to your source code to import the SDK:

    #import <ApigeeiOSSDK/Apigee.h>
  2. Declare the following properties in AppDelegate.h :

    @property (strong, nonatomic) ApigeeClient *apigeeClient; 
    @property (strong, nonatomic) ApigeeMonitoringClient *monitoringClient;
    @property (strong, nonatomic) ApigeeDataClient *dataClient;	
    		
  3. Instantiate the ApigeeClient class inside the  didFinishLaunching method of AppDelegate.m :

    //Replace 'AppDelegate' with the name of your app delegate class to instantiate it
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    
    //Sepcify your App Services organization and application names
    NSString *orgName = @"{{currentOrg}}";
    NSString *appName = @"{{currentApp}}";
    
    //Instantiate ApigeeClient to initialize the SDK
    appDelegate.apigeeClient = [[ApigeeClient alloc]
                                initWithOrganizationId:orgName
                                applicationId:appName];
                                
    //Retrieve instances of ApigeeClient.monitoringClient and ApigeeClient.dataClient
    self.monitoringClient = [appDelegate.apigeeClient monitoringClient]; 
    self.dataClient = [appDelegate.apigeeClient dataClient]; 
    		

5. Verify SDK installation

Once initialized, App Services will also automatically instantiate the ApigeeMonitoringClient class and begin logging usage, crash and error metrics for your app.

To verify that the SDK has been properly initialized, run your app, then go to 'Monitoring' > 'App Usage' in the App Services admin portal to verify that data is being sent.

screenshot of data in admin portal

It may take up to two minutes for data to appear in the admin portal after you run your app.

Installation complete! Try these next steps