gpt4 book ai didi

ios - 应用程序连接错误 : AppConnect cannot be instantiated directly

转载 作者:可可西里 更新时间:2023-11-01 02:16:59 24 4
gpt4 key购买 nike

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

[AppConnect:Error] AppConnect cannot be instantiated directly. Instead, call +initWithDelegate: and then +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 后端配置文件的 key 时崩溃。

还有其他实现方式吗?

最佳答案

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

改变

var appct = AppConnect();

var appct : AppConnect!;

关于ios - 应用程序连接错误 : AppConnect cannot be instantiated directly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37024457/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com