gpt4 book ai didi

swift - remoteNotification swift 3 的 UIApplicationLaunch 不工作

转载 作者:搜寻专家 更新时间:2023-11-01 07:20:08 24 4
gpt4 key购买 nike

我在 swift 2.2 中工作正常,但是当我转换到 swift 3.0 时出现错误。

//If app open by notification
if launchOptions != nil
{
NSLog("launch------ %@", launchOptions!)

let userInfo = launchOptions!(UIApplicationLaunchOptionsKey.remoteNotification) as NSDictionary
if userInfo != nil
{
self.application(UIApplication.shared, didReceiveRemoteNotification: (userInfo)! as! [NSObject : AnyObject])
}
}

类似错误

Cannot call value of non-function type '[NSObject : Any]'

提前致谢。

最佳答案

最后我修好了:-

if launchOptions != nil
{
NSLog("launch------ %@", launchOptions!)
let userInfo = launchOptions![UIApplicationLaunchOptionsKey.remoteNotification] as! NSDictionary
if userInfo != nil
{
self.application(UIApplication.shared, didReceiveRemoteNotification:(userInfo) as! [AnyHashable : Any] as! [String : AnyObject])
}
}

关于swift - remoteNotification swift 3 的 UIApplicationLaunch 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39590852/

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