gpt4 book ai didi

ios - AppDelegate.swift 函数在转换为 swift 3 后返回错误(无法转换为 PFBooleanResultBlock?)?

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

我最近将我的应用程序从以前版本的 swift 转换为 swift 3.0(并且还安装了最新版本的 Xcode),除此之外,我还收到了以下错误:

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let installation = PFInstallation.current()
installation.setDeviceTokenFrom(deviceToken)
installation.saveInBackground()

PFPush.subscribeToChannel(inBackground: "") { (succeeded: Bool, error: NSError?) in
if succeeded {
print("ParseStarterProject successfully subscribed to push notifications on the broadcast channel.\n");
} else {
print("ParseStarterProject failed to subscribe to push notifications on the broadcast channel with error = %@.\n", error)
}
}
}

这来 self 作为模板下载的 SDK(PF 指的是 Parse 框架......我正在使用由 Heroku 托管的 Parse-server)。返回错误说:“无法将类型 '(Bool,NSError?)-> ()' 的值转换为预期的参数类型 'PFBooleanResultBlock?'”

不知道如何解决这个问题。有人有什么想法吗?

最佳答案

我相信您可以这样更改代码:

    PFPush.subscribeToChannel(inBackground: "", block: {(succeeded, error) -> Void in
if succeeded {
print("ParseStarterProject successfully subscribed to push notifications on the broadcast channel.\n");
} else {
print("ParseStarterProject failed to subscribe to push notifications on the broadcast channel with error = %@.\n", error)
}
}

关于ios - AppDelegate.swift 函数在转换为 swift 3 后返回错误(无法转换为 PFBooleanResultBlock?)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39646261/

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