iOS SDK Setup
To integrate AppsOnAir-AppRemark iOS SDK into your iOS native Apps with Swift, SwiftUI or Objective-C, follow the below steps
Basic Requirements for Service Usage
- Make sure to configure the App ID properly. For additional information Getting started
Requirements
- Minimum deployment target: iOS 15.0
Info.plist Must Contain the NSPhotoLibraryUsageDescription Property
The NSPhotoLibraryUsageDescription name property used in your photo library to allow you to view and select images directly within the application. By granting this permission, you can easily upload photos, create personalized content, and enhance your experience. We respect your privacy and will only use this access to improve your app experience and will never share your photos without your consent .
Import the AppsOnAir-AppRemark iOS SDK into Your Xcode Project
- Swift Package Manager (recommended)
- CocoaPods
- In Xcode, go to File > Add Package Dependencies...
- Enter the repository URL:
https://github.com/apps-on-air/AppsOnAir-iOS-AppRemark.git - Select the version rule (e.g. Up to Next Major) and click Add Package.
- Select the
AppsOnAir-AppRemarkproduct and add it to your target.
-
Make sure your current Xcode project is closed and in the project root, run
sudo gem install cocoapods. -
Now run
pod initfrom the terminal in your project directory. -
Open the newly created
Podfilewith the code editor you are preferring to open. -
Add the AppsOnAir AppRemark dependency under your project target like below.
target 'your_project_name' do
#only copy below line and paste into your podfile
pod 'AppsOnAir-AppRemark'
end
- Run the following commands on the terminal window of your project's directory.
pod repo update
pod install
- Now open the newly created
<project_name>.xcworkspacefile.
Add the AppsOnAir Services Initialization Code and Usage
You can call initialization at your preference; however, we recommend you add initialization code in the AppDelegate file's didFinishLaunchingWithOptions method as follows:
- Swift/SwiftUI:
import AppsOnAir_AppRemark - Objective-C:
#import "AppsOnAir_AppRemark-Swift.h
- Swift
- Objective-C
- SwiftUI
import AppsOnAir_AppRemark
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
// AppRemark Class instance create
let appsOnAirRemarkServices = AppRemarkService.shared
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// help to initialize remark services and customized the screen also using optional
appsOnAirRemarkServices.initialize(shakeGestureEnable: false,options: ["appBarBackgroundColor":"DAF7A6"]) { remarkInfo in
// write the code for handling success and failure case
}
return true
}
// Remaining contents of your AppDelegate Class...
}
#import "AppsOnAir_AppRemark-Swift.h"
@interface AppDelegate ()
@property (nonatomic, strong) AppRemarkService *appRemarkService;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Help to create App Remark Class instance
self.appRemarkService = [AppRemarkService shared];
// Help to initialize remark services and customized the screen also using optional
[self.appRemarkService initializeWithShakeGestureEnable:true options:@{@"appBarBackgroundColor": @"DAF7A6"} onRemarkResponse:^(NSDictionary<NSString *,id> * remarkInfo) {
// write the code for handling success and failure case
}];
return YES;
}
// Remaining contents of your AppDelegate Class...
end
import SwiftUI
import AppsOnAir_AppRemark
@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 {
// Help to create App Remark Class instance
let appsOnAirRemarkService = AppRemarkService.shared
// help to initialize remark services and customized the screen also using optional
appsOnAirRemarkServices.initialize(shakeGestureEnable: false,options: ["appBarBackgroundColor":"DAF7A6"]) { remarkInfo in
// write the code for handling success and failure case
}
return true
}
// Remaining contents of your AppDelegate Class...
}
- This method configures the remark service.
- The
shakeGestureEnableparameter controls whether the shake gesture is enabled or disabled for triggering the remark screen. - The
shakeSensitivityparameter (optional) controls how hard the device must be shaken to open the feedback screen. Defaults to the system shake gesture when not set. - The
optionsparameter accepts a dictionary for customizing the remark screen's UI, such as modifying the app bar's background color or other visual elements. - The
onRemarkResponsemethod listens for the feedback status when feedback is submitted, such as success or failure responses.
shakeSensitivity values
| Value | Description |
|---|---|
.veryLow | Very hard, deliberate shake required |
.low | Firm shake required |
.medium | Normal shake |
.high | Light shake triggers feedback |
.veryHigh | Any motion triggers feedback |
Pass shakeSensitivity directly in initialize:
- Swift/SwiftUI
- Objective-C
appRemarkService.initialize(
shakeGestureEnable: true,
options: [:],
shakeSensitivity: .medium
) { remarkInfo in
// handle response
}
[self.appRemarkService initializeWithShakeGestureEnable:true
options:@{}
shakeSensitivity:ShakeSensitivityMedium
onRemarkResponse:^(NSDictionary<NSString *,id> *remarkInfo) {
// handle response
}];
To update sensitivity at runtime (e.g. from app settings) without re-initializing:
- Swift/SwiftUI
- Objective-C
AppRemarkService.shared.setShakeSensitivity(.high)
[[AppRemarkService shared] setShakeSensitivity:ShakeSensitivityHigh];
Note: On the iOS Simulator there is no accelerometer —
shakeSensitivityis ignored and Device > Shake (⌃⌘Z) opens the feedback screen instead.
onRemarkResponse listener response
{
"message": "Remark added successfully.",
"status": "SUCCESS"
}
| Field | Type | Description | Example |
|---|---|---|---|
message | string | A descriptive message providing details about the feedback submission status. | "Remark added successfully." |
status | "SUCCESS" | "FAILURE" | Indicates whether the feedback submission succeeded or failed in the onRemarkResponse listener. | "SUCCESS" |
Available keys of options for Customization
| Key | DataType | Value | Description |
|---|---|---|---|
pageBackgroundColor | String | "#E8F1FF" | Set page background color |
appBarBackgroundColor | String | "#E8F1FF" | Set appbar background color |
appBarTitleText | String | "Add Remark" | Set appbar title text |
appBarTitleColor | String | "#000000" | Set appbar title color |
remarkTypeLabelText | String | "Remark Type" | Set remark type label text |
descriptionLabelText | String | "Description" | Set description label text |
descriptionHintText | String | "Add description here..." | Set description hint text |
descriptionMaxLength | int | 255 | Set description max length |
buttonText | String | "Submit" | Set button text |
buttonTextColor | String | "#FFFFFF" | Set button text color |
buttonBackgroundColor | String | "#007AFF" | Set button background color |
labelColor | String | "#000000" | Set text field label color |
hintColor | String | "#B1B1B3" | Set text field hint color |
inputTextColor | String | "#000000" | Set text field input text color |
Manually Open the AppRemark Screen
- Swift/SwiftUI
- Objective-C
// Help to Create App Remark Service Class
let appsOnAirRemarkServices = AppRemarkService.shared
//Help to open remark screen manually
appsOnAirRemarkServices.addRemark()
// Help to Create App Remark Service Class
@property (nonatomic, strong) AppRemarkService *appRemarkService;
//Help to open remark screen manually
self.appRemarkService = [AppRemarkService shared];
[self.appRemarkService addRemark];
- This method is used to manually open the remark screen.
Manually Add Additional Meta
- Swift/SwiftUI
- Objective-C
// Help to Create App Remark Service Class
let appRemarkService = AppRemarkService.shared
//Help to add extra data about app
appRemarkService.setAdditionalMetaData(extraPayload: ["UserID":"UserID"])
// Help to Create App Remark Service Class
@property (nonatomic, strong) AppRemarkService *appRemarkService;
//Help to add extra data about app
self.appRemarkService = [AppRemarkService shared];
[self.appRemarkService setAdditionalMetaDataWithExtraPayload:@{@"UserID":@"UserID"}];
- The
setAdditionalMetaDatamethod is optional and can be used to pass additional metadata inextraPayloadparams, such as the app version, flavors, or any other contextual information. This data is sent along with the feedback to enhance tracking and categorization, making it easier to analyze and act on user inputs effectively.
Run App & Verify App Remark Services
Run your app by using Xcode on iOS simulators or any physical device to make sure it builds correctly.