gpt4 book ai didi

swift - Urban Airship swift

转载 作者:行者123 更新时间:2023-11-28 06:35:41 27 4
gpt4 key购买 nike

我正在尝试将 UrbanAirship 集成到我的项目中,但出现以下错误:

2016-08-25 16:26:23.898 Fibre[7758:368753] [E] __52+[UAirship handleAppDidFinishLaunchingNotification:]_block_invoke [Line 320] Please ensure that [UAirship takeOff] is called synchronously before application:didFinishLaunchingWithOptions: returns

如果能帮助解决这个问题,我们将不胜感激!

我的申请委托(delegate)如下:

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

// Override point for customization after application launch.
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)

let configuration = ParseClientConfiguration { (configuration) -> Void in

configuration.applicationId = "******"
configuration.clientKey = "*****"
configuration.server = "https://*****.herokuapp.com/parse"

}

Parse.initializeWithConfiguration(configuration)

let config: UAConfig = UAConfig.defaultConfig()
UAirship.takeOff(config)

return true
}

最佳答案

我自己之前没有使用过 Urban Airship SDK,但是您发布的错误消息似乎是“在应用程序之前同步调用:didFinishLaunchingWithOptions:返回”。

我猜测发生的事情是您在 UAirship 上调用 takeOff 方法,但 didFinishLaunchingMethod 在该方法完成之前返回;很可能是因为它正在另一个线程中处理)。

尝试使用“dispatch_async”强制在主线程上运行 takeOff 方法,然后传入主队列,例如:

dispatch_async(dispatch_get_main_queue(), {
UAirship.takeOff(config)
})

尝试一下,希望能解决问题。

关于swift - Urban Airship swift ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39149248/

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