Reputation: 754
I am getting an error, While accessing MDM using AppConnect SDK in swift 1.2.
Error :
[AppConnect:Error] AppConnect is unable to start because [UIApplication sharedApplication] is not an instance of AppConnectUIApplication.
Code Snippet :
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, AppConnectDelegate {
var window: UIWindow?
var appct : AppConnect!;
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
// Initialize the AppConnect library
AppConnect.initWithDelegate(self)
self.appct = AppConnect.sharedInstance()
self.appct.startWithLaunchOptions(launchOptions)
return true
}
}
Application is crashing at self.appct = AppConnect.sharedInstance()
Upvotes: 1
Views: 593
Reputation: 565
My solution was to set a new key/value in the plist:
Principal class AppConnectUIApplication
or in source mode:
<key>NSPrincipalClass</key>
<string>AppConnectUIApplication</string>
Hope it help you
Upvotes: 0
Reputation: 2468
Comment out @UIApplicationMain
and change your main.swift file to the following:
import Foundation
UIApplicationMain(Process.argc, Process.unsafeArgv, "AppConnectUIApplication", NSStringFromClass(AppDelegate))
For more information, follow the setup instructions in the Documentation folder of the SDK source. (You have to make sure you follow the instructions of the document that matches the SDK that you are using since MI changes things frequently.)
Upvotes: 2