Skip to main content
Version: 14

Project Setup (iOS/Swift)

Step-by-step Instruction

  1. Create a new Xcode project and select "Single View App".

  2. The project name chosen for this document is "MCWMPGettingStartedSwift". However, you can choose another name.

  3. Select the project file and choose target "MCWMPGettingStartedSwift" and Click on the '+' button in the section Embedded Binaries and Select the 'Add Other...' option in the opening section.

  4. Chose MasterContoller and Hardening the XC-framework in the finder. Apple defines XCFrameworks as a distributable binary package created by Xcode that contains variants of a framework or library so that it can be used on multiple platforms (iOS, macOS, tvOS, and watchOS), including Simulator builds. An XCFramework can be either static or dynamic and can include headers. 'We have also provided our MasterContoller and Hardening framework as a XCFramework.'

  5. 'Embedded Binaries' and 'Linked Frameworks and Libraries' sections should look like below. "KSMasterController.xcframework" and "hnb.xcframework" in 'Linked Frameworks and Libraries' are automatically added. There is no need for extra effort to add the frameworks in that section.

  6. You can also give support to multiple servers in your application by simply adding the SDK configuration file of that server. You can add this server configuration file like this.

You can switch your server in the currently running application also, for that you have to first delete all users of the existing server and then select a server on which you want to switch.

To activate users on different Servers please go to the respective server.

Initial Steps

  1. Make sure you have all the required assets and framework to proceed with MasterController SDK.

    • MasterController SDK framework for both debug and release mode.
    • GettingStartedApps and MC configuration files
  2. You need to follow the below steps so that the application starts communication with the master controller framework

    • Add a master controller framework using artifacts in your project.
    • We have used a MasterControllerAdaptor class to communicate with Master Controller but to start the real communication we have initialized its components in Applegate.
  3. Register your app version in Security Server.

Further Informations

The MasterController and Hardening are delivered in two different variants, one you find in the debug folder and the other one in the release folder. Please look into the following table for the differences and take the correct MasterController Hardening for you situation

DebugRelease
KOBIL App Security is disabled, e.g. attaching iOS debugger is allowed and KOBIL App Security use dummy valuesKOBIL App Security is enabled, e.g. attaching iOS debugger are denied
Some MC logs are written to the Xcode consoleMC logs are not written to the Xcode console, only encrypted log files are avalaible
You should not use this for productive usage, there is a notification on startup

Backup of iPhone and iPad

Because of security reasons is KOBIL App Security's device binding parameter not stored to iCloud or local computer backups. So after restoring a backup the user will loose the activation and has to activate the app again. Therefore KOBIL recommended to app development to disallow app backup:

If user make a backup you need to prevent iOS system to backup a database file. Please use NSURLIsExcludedFromBackupKey property. Use this property to exclude cache and other app support files that aren’t necessary in a backup. Set this property each time you save a file because some common file operations cause this property to reset to false.

NSURLIsExcludedFromBackupKey usage
    func excludeFromBackup() {
// DB located in `ApplicationSupport` directory
var paths = NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true)[0]
// add this path components to URL
paths.append("/database/key_value_db.sqlite")
var fileURL = URL(fileURLWithPath: paths)
var resourceValues = URLResourceValues()
resourceValues.isExcludedFromBackup = true

do {
// Apply changes
try fileURL.setResourceValues(resourceValues)
// To check a result you can call this function
let res = try fileURL.resourceValues(forKeys: [URLResourceKey.isExcludedFromBackupKey])
print(res)
} catch {
print(error)
}
}