Note : The APM SDK for iOS provides much functionality and countless customization options at high performance, requiring somewhat more storage space than a simpler framework would. Nonetheless, the SDK contributes only 4 MB to the ultimate size of your application, thanks to various optimization steps that occur during the compilation and App Store submission processes.
2. Integration
Configuration
Set in your info.plist :
APMPartnerID
APMPartnerSecret
Initialize APM, in your « AppDelegate »
In YourAppDelegate.h, import APMHeaders.h
#import <APM/APMHeaders.h>
In YourAppDelegate.m, implements URL Scheme callback
You can launch the app, the banner or the sticker will be appear now.
3. Connection client
Use the method [APMUIServicesUser userClientConnect] for connect automatically your user to app’s miles.
If no account exist with this informations, the server create automatically this account.
This method needs : « email », « userID » and « optIn »
– « email » is the email of user– « userID » is a unique identifier in your database
– « optIn » is the RGPD OptIn
If you don’t want pass the email, you can build a encrypted email with the userID, for example : 123456789@appsmiles.fr
– 123456789 is the userID
Implements this for :– app’s miles account and client account not connected, so, redirect user to your process login/register account– app’s miles account not connected and client account connected, so, connect app’s miles account with method userClientConnect– app’s miles account and client account connected, so, nothing
@interface AbstractViewController() <APMOnboardingUtilsListener>
//...
//Declare a object of APMOnboardingUtils in your class
@property (strong, nonatomic) APMOnboardingUtils* onboardingUtils;
@end
@implementation AbstractViewController
-(void)viewDidLoad
{
[super viewDidLoad];
//...
//AbstractViewController become the listener on events of onboarding
self.onboardingUtils = [[APMOnboardingUtils alloc] init];
self.onboardingUtils.delegate = self;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
//...
//Listen events of onboarding
[self.onboardingUtils registerNotifications];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
//...
//Unlisten events of onboarding
[self.onboardingUtils unregisterNotifications];
}
#pragma mark - APMOnboardingUtilsListener
-(void)apmOnboardingButtonOkClicked
{
//Get the event OnboardingButtonOkClicked
BOOL clientAccountConnected = YES;
if(clientAccountConnected) //TODO check if account client is connected
{
//Account client is connected
APMServices* services = [APMServices sharedInstance];
if(services.user && [services.user isConnected])
{
//Client account connected and app's miles account connected
NSLog(@"Client account connected and app's miles account connected");
}
else
{
//Client account connected --> need to connect app's miles account
NSLog(@"Client account connected --> need to connect app's miles account");
[YourAppDelegate apmConnection];
}
}
else
{
//TODO show screen login/create account
}
}
-(void)apmOnboardingButtonLaterClicked { }
-(void)apmOnboardingButtonNeverClicked { }
@end