gpt4 book ai didi

swift - "UIApplication.sharedApplication().delegate"swift_dynamicCastClassUnconditional

转载 作者:行者123 更新时间:2023-11-28 07:13:17 24 4
gpt4 key购买 nike

尝试访问我的 AppDelegate 实例但因 swift_dynamicCastClassUnconditional 而失败。

class AppDelegate: UIResponder, UIApplicationDelegate {
class func getInstance() -> AppDelegate {
let delegate = UIApplication.sharedApplication().delegate;
return delegate as AppDelegate;
}
........
}

有什么想法吗?谢谢。

最佳答案

原来是Urbanairship库引起的。当应用程序初始化时,我调用了 api

    var uaconfig = UAConfig.defaultConfig() as UAConfig
UAirship.setLogLevel(UALogLevel.Debug)
UAirship.takeOff(uaconfig)
UAPush.shared().userNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound
UAPush.shared().userPushNotificationsEnabled = true

我删除上面的代码后,现在一切都很好。

关于swift - "UIApplication.sharedApplication().delegate"swift_dynamicCastClassUnconditional,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27560257/

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