我正在尝试使用AppConnect中的swift 1.2 SDK访问MDM,但出现以下错误:

[AppConnect:Error]无法直接实例化AppConnect。
相反,请先致电+ initWithDelegate :,然后致电+ sharedInstance。

代码段:

 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
        }
}

访问MobileIron后端配置文件的密钥时,应用程序崩溃。

还有其他方法可以实现吗?

最佳答案

您正在初始化没有委托的AppConnect

更改
var appct = AppConnect();

var appct : AppConnect!;

关于ios - AppConnect错误:无法直接实例化AppConnect,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37024457/

10-09 16:24