Skip to main content

iOS SDK Setup AppSync

To integrate AppsOnAir-AppSync iOS SDK to your iOS native Apps with Swift, SwiftUI or Objective-C, follow the below steps

Step 1. Basic Requirements for service usage

apiKey Setup
  • Make sure to configure the API key properly. For additional information Getting started

Step 2. Import the AppsOnAir-AppSync iOS SDK into your Xcode Project

Using CocoaPods

2.1 Make sure your current Xcode project is closed and in the project root, run sudo gem install cocoapods.

2.2 Now run pod init from the terminal in your project directory.

2.3 Open the newly created Podfile with the code editor you are preferring to open.

2.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-AppSync'
end

2.5 Run the following commands on the terminal window of your project's directory.

pod repo update
pod install

2.6 Now open the newly created <project_name>.xcworkspace file.

Step 3. Add the AppSync service 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_AppSync
  • Objective-C: #import "AppsOnAir_AppSync-Swift.h"
AppDelegate.swift

import AppsOnAir_AppSync
import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

// AppSync Class instance create
let appsOnAirSyncService = AppSyncService.shared

// AppSync common services Initialization
appsOnAirSyncService.sync(directory: ["showNativeUI":false]) { appUpdateData in
// Write the code here when showNative UI is false
}
return true
}
// Remaining contents of your AppDelegate Class...
}

Properties Information

sync(directory: NSDictionary = ["showNativeUI": true],completion: @escaping (NSDictionary) -> () = { _ in })
  • This method performs synchronization of app update data.
  • The directory parameter accepts a dictionary of configuration options, including showNativeUI, which controls the display of the native update UI (set to true or false)
  • The completion handler receives the update data, allowing for custom handling and presentation of the update information through a personalized UI

Step 4. 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.

note
Note that to check the App Update and maintenance services are only configured from AppsOnAir portal.

For more details explore the example