iOS
Provided Frameworks
In this section, we will learn about the integration of the Master Controller SDK into a sample iOS application.
The MC SDK comes with the following frameworks, which are all required for proper functioning (except "kssidp.xcframework" and KSTrustedWebView.xcframework ):
KSMasterController.xcframework (Debug and Release) Contains all the classes of the Master Controller (MC) API for iOS, facilitating the use of MC functionalities in iOS applications. There is no difference between the debug and release apart from the ability of debugging native code (c / c++) with debug build configuration.
hnb.xcframework (hardening-ios): Provides security mechanisms to protect the native code and secure the application against various threats. Debug: Enables app startup in iOS Simulator and allows debugging with the iOS Debugger. Release: Intended for distribution to end users, without debugger support.
KSTrustedWebView.xcframework A software stack that adds additional security to WebView inside a KOBIL Secured App. It includes features like SSL/TLS certificate pinning for enhanced security.
kssidp.xcframework Built on top of the MasterController SDK, this framework facilitates activation, login, change password, and forgot password flows. It simplifies these processes by allowing applications to maintain their native interfaces while handling these operations without direct communication with the IDP.
Do NOT use the debug build configuration libraries for release/production purposes.
Our libraries are delivered and tested in specific combinations in QA. We strongly recommend using the exact combination of libraries delivered to avoid compatibility issues. Avoid mixing libraries from different release packages to streamline troubleshooting and ensure compatibility with our tested configurations.
Note: KSSIDP is specifically for Shift environments, not for Digitanium/Digitanium+.
Integrating MCSDK with Swift Package Manager
You can integrate MCSDK into your project using Swift Package Manager (SPM). Since MCSDK is provided as a compiled SDK (.xcframework), you’ll need to follow a few extra steps compared to a source-only package.
1. Create a Wrapper Module
Because the SDK is precompiled, it’s a good practice to create a wrapper target. This wrapper provides a clean, public interface for your application code while encapsulating direct access to the binary frameworks.
import KSMasterController
public final class MCSDKPackage {
public private(set) var text = "Hello, World!"
private var masterController: (any KSAsyncEventReceiver & KSEcoModulInterface & KSEventSource)?
public init() {}
/// Initializes the master controller
public func createMasterController() {
masterController = KSMasterControllerFactory.getMasterController(withParmeter: "", andConsumer: self)
}
/// Example: sending a simple information event
public func sendEvent() {
let event = KSMGetInformationEvent()
masterController?.receive(event, withCompletionHandler: { resultEvent in
print("Received \(resultEvent)")
})
}
/// Example: sending a start event with configuration data
public func sendStartEvent(
astServerBackend: String,
mcConfigString: String,
certData: Data,
sdkConfig: Data
) {
let startEvent = KSMStartEventEx(
serverBackend: astServerBackend,
ssmsAppConfiguration: loadSsmsAppConfiguration(sdkConfig: sdkConfig),
mcConfig: mcConfigString,
certificateChain: certData,
configurationData: KSMConfigurationData(category: "", tagName: "")
)
masterController?.receive(startEvent, withCompletionHandler: { resultEvent in
print("Received \(resultEvent)")
})
}
private func loadSsmsAppConfiguration(sdkConfig: Data) -> KSMSsmsAppConfiguration {
let version = KSMVersion(majorVersion: 12, minorVersion: 0, build: 0)
return KSMSsmsAppConfiguration(
locale: "de",
version: version,
name: "clientBackend",
sdkconfig: sdkConfig
)
}
}
extension MCSDKPackage: KSAsyncEventReceiver {
func sendEvent2MasterController(
event: KSMEvent,
withCompletionHandler completionBlock: ((KsEvent?) -> Void)? = nil
) {
// implement if needed
}
public func receive(
_ event: KsEvent,
withCompletionHandler completionBlock: ((KsEvent?) -> Void)? = nil
) {
// handle received events here
}
}