iOS SDK Setup
To integrate AppsOnAir iOS SDK to your iOS native Apps with Swift, SwiftUI or Objective-C, follow the below steps
1. Basic Requirements for service usage
- Create of log into your AppsOnAir (AoA) account
- Goto the your app details page -> App services tab -> API key tab to get your AoA services API Key.
- At present, AoA supports iOS 10+ or iPadOS(iPhone, iPad, iPod Touch) to test on
- A Mac with Xcode 13+
Step 2. Info.plist
must contain a Bundle display name
property
The Bundle display name
property allows you to display your app name while installing App on a specific device. This property mandatory because it is uses a bundle display name to show an alert with this property value. Refer to the following image for more details.
Step 3. Import the AoA iOS SDK into your Xcode Project
Using CocoaPods
3.1 Make sure your current Xcode project is closed and in the project root, run sudo gem install cocoapods
.
3.2 Now run pod init
from the terminal in your project directory.
3.3 Open the newly created Podfile
with the code editor you are preferring to open.
3.4 Add the AoA dependency under your project target like below.
target 'your_project_name' do
#only copy below line and paste into your podfile
pod 'AppsOnAir'
end
3.5 Run the following commands on the terminal window of your project's directory.
pod repo update
pod install
3.6 Now open the newly created <project_name>.xcworkspace
file.
Step 4. Add the AoA services initialization code and usage
You can call initialization at your preference however, we recommend you to add initialization code in AppDelegate file's didFinishLaunchingWithOptions
method as follows:
- Swift/SwiftUI:
import AppsOnAir
- Objective-C:
#import "AppsOnAir-Swift.h"
- Swift
- Objective-C
- SwiftUI
import AppsOnAir
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//AppsOnAir ios services Initialization
let appsOnAirServices = AppsOnAirServices()
// appsOnAirServices.setAppId(APP_ID: "XXXXX-XXXX-XXXX-XXXX-XXXXXXXX", showNativeUI: true/false)
appsOnAirServices.setAppId('YOUR_APPS_ON_AIR_SERVICES_API_KEY', true) // 2nd Boolean parameter stands for showing our custom UI or not. Either if it is set to `true` it will show the default UI or if it is set to `false` it will not show the default UI.
return true
}
// Remaining contents of your AppDelegate Class...
}
#import "AppsOnAir-Swift.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//AppsOnAir ios services Initialization
AppsOnAirServices *appsOnAirServices = [[AppsOnAirServices alloc] init];
// [appsOnAirServices setAppId:@"XXXXX-XXXX-XXXX-XXXX-XXXXXXXX" showNativeUI: YES/NO];
[appsOnAirServices setAppId:@"YOUR_APPS_ON_AIR_SERVICES_API_KEY" :YES]; // 2nd Boolean parameter stands for showing our custom UI or not. Either if it is set to `true` it will show the default UI or if it is set to `false` it will not show the default UI.
return YES;
}
// Remaining contents of your AppDelegate Class...
end
import SwiftUI
import AppsOnAir
@main
struct YOUR_APP_NAME: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
//AppsOnAir ios services Initialization
let appsOnAirServices = AppsOnAirServices()
// appsOnAirServices.setAppId(APP_ID: "XXXXX-XXXX-XXXX-XXXX-XXXXXXXX", showNativeUI: true/false)
appsOnAirServices.setAppId('YOUR_APPS_ON_AIR_SERVICES_API_KEY', true) // 2nd Boolean parameter stands for showing our custom UI or not. Either if it is set to `true` it will show the default UI or if it is set to `false` it will not show the default UI.
return true
}
// Remaining contents of your AppDelegate Class...
}
Step 5. Set Custom UI (Optional step)
If you want to show a custom alert for app updates and maintenance dialogue then the setAppId
is recommended the second parameter should be set to false
. Now, call checkForAppUpdate
to show a custom alert for app updates and maintenance dialogue to match your design requirements. To use this method wherever needed, use the same import statement that has been used in the previous step. Use this method as follows:
- Swift/SwiftUI
- Objective-C
let appsOnAirServices = AppsOnAirServices()
appsOnAirServices.checkForAppUpdate { (appUpdateData) in
if(appUpdateData.count > 0) {
// Do your code to show your custom UI.
}
}
AppsOnAirServices *appsOnAirServices = [[AppsOnAirServices alloc] init];
[appsOnAirServices checkForAppUpdate:^(NSDictionary * appUpdateData) {
if(appUpdateData.count > 0) {
// Do your code to show your custom UI.
}
}];
Step 6. Run your App and Setup your app update and/or its maintenance services
Run your app by using Xcode on iOS simulators or any physical device to make sure it builds correctly.