Quickstart

Follow these steps to have a basic integration of the app's miles® SDK in your iOS application.

iOS Quickstart

Estimated time: 20 minutes

This guide will go over:

  • Conditions and minimum requirements

  • Installation 📦

  • Configuration

  • Initialization

  • Attaching 🔗

Conditions and minimum requirements

Minimum iOS version : 8.0 Minimum XCode version : 8

I. Installation

CocoaPods:

use_frameworks!
source 'https://gitlab.appsmiles.eu/appsmiles/APMSpecs.git'
source 'https://github.com/CocoaPods/Specs.git'
pod 'APM', '~> 5.5.1'

https://gitlab.appsmiles.eu is a private repository, you need a login and a password Set the login and password on next pod install or pod update Contact us to get a login and password

The APM SDK for iOS provides many functionalities, UI components and countless customization options at a high performance, requiring somewhat more storage space than a simpler framework would. Nonetheless, the SDK contributes only 4 MB to the final size of your application, thanks to various optimization steps that occur during the compilation and App Store submission processes.

iOS dependencies

Our SDK use the dependencies lottie-ios to work.

APM.podspec
APM.podspec
# Dependency for APM
s.dependency 'APMServices', '4.4.1'
s.dependency 'lottie-ios'

For more information about lottie-ios, click here

II. Configuration

Add these frameworks SystemConfiguration, MessageUI and CoreLocation

Capture d’écran 2015-10-23 à 11.53.35

III. Initialization

In YourAppDelegate.java, in the method application:didFinishLaunchingWithOptions, retrieve an instance of APM and init the SDK with your credentials environments

#import <APM/APMHeaders.h>
...
-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
NSString* partnerId = CONFIG_PARTNER_ID;
NSString* partnerSecret = CONFIG_PARTNER_SECRET;
NSString* appId = [[NSBundle mainBundle] bundleIdentifier];
NSString* baseUrl = BASE_URL;
//Init SDK APM
APM *apm = [APM sharedInstance];
[apm initAppWithPartnerID:partnerId withPartnerSecret:partnerSecret withAppId:appId];
apm.baseUrl = baseUrl;
}

You can declare multiple environments using the application's packageName or you can specifically declare environments with the appId variable.

#import <APM/APMHeaders.h>
...
-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
NSString* partnerId = CONFIG_PARTNER_ID;
NSString* partnerSecret = CONFIG_PARTNER_SECRET;
NSString* appId;
NSString* baseUrl;
if(SANDBOX) {
appId = @"com.your_company.your_app_sandbox";
baseUrl = @"https://api-sb.appsmiles.eu/";
}
else {
appId = @"com.your_company.your_app";
baseUrl = @"https://api-prod1.appsmiles.eu/"
}
//Init SDK APM
APM *apm = [APM sharedInstance];
[apm initAppWithPartnerID:partnerId withPartnerSecret:partnerSecret withAppId:appId];
apm.baseUrl = baseUrl;
}

Environment

URL

PRODUCTION

https://api-prod1.appsmiles.eu/

SANDOX

https://api-sb.appsmiles.eu/

We host projects on multiple servers, double check with us or your team to verify the base URL

IV. Attaching

Attaching to a « ViewController »

Import APMHeaders.h

#import <APM/APMHeaders.h>
Automatically
Manually
Automatically

You can extend your GlobalViewController with APMClientViewController or APMClientNavigationController or APMClientTabBarController

@interface GlobalViewController : APMClientViewController
//OR
@interface GlobalViewController : APMClientNavigationController
//OR
@interface GlobalViewController : APMClientTabBarController
Manually

Add the following methods in your GlobalViewController

  • viewDidLoad:controller;

  • viewWillAppear:controller;

  • viewDidAppear:controller;

  • viewWillDisappear:controller;

  • viewDidDisappear:controller;

-(void)viewDidLoad {
[super viewDidLoad];
[APMClientViewControllerUtils viewDidLoad:self];
}
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[APMClientViewControllerUtils viewWillAppear:self];
}
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[APMClientViewControllerUtils viewDidAppear:self];
}
-(void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[APMClientViewControllerUtils viewWillDisappear:self];
}
-(void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
[APMClientViewControllerUtils viewDidDisappear:self];
}

You're done with the installation !

And the banner appear !

Head to the next section to start integrating our SDK into your app's features.