在 swift 1.2 中使用 AppConnect SDK 访问 MDM 时出现错误。
错误 :
[AppConnect:Error] AppConnect 无法启动,因为 [UIApplication sharedApplication] 不是 AppConnectUIApplication 的实例。
代码片段:
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
}
}
应用程序崩溃self.appct = AppConnect.sharedInstance()