gpt4 book ai didi

swift - 如何使用 Swift 将 Parse 安装 objectId(或 devicetoken)保存为 cookie

转载 作者:行者123 更新时间:2023-11-28 09:05:15 25 4
gpt4 key购买 nike

我已将 Parse 添加到我的 iOS Swift 应用程序,并且可以将消息推送到我的测试手机。现在我希望能够将 Parse 安装 objectId 保存为 cookie 以将此信息传递到我的服务器。

经过几个小时的搜索后,我无法找到如何获取 Parse 安装对象 ID,因为我不知道如何访问它,所以我求助于好心人给我举个例子在 swift 。获得 Id# 后,我将研究如何将其保存为 cookie。

通常我总是能够找到我可以使用、适应或学习的东西,但在这种情况下,我似乎碰壁了。任何帮助将不胜感激。

最佳答案

你试过用这个吗?

PFInstallation.currentInstallation().objectId!

这是完整的代码。它确保您已经注册:

let installation = PFInstallation.currentInstallation()
installation.setDeviceTokenFromData(deviceToken)
installation.saveInBackgroundWithBlock { (isSuccess, hasError) -> Void in
if isSuccess{
println("registered!")
println("Parse Installation Id: \(PFInstallation.currentInstallation().objectId!)")
}else{
println("Error: \(hasError)")
}
}

查看api后得到代码:

http://parse.com/docs/ios/api/Classes/PFInstallation.html#//api/name/currentInstallation

关于swift - 如何使用 Swift 将 Parse 安装 objectId(或 devicetoken)保存为 cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30972814/

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