订阅频道无法正常工作 - 使用Swift解析

时间:2016-06-30 13:50:58

标签: ios swift parse-platform

在你说什么之前 - 是的我知道Parse正在关闭:)但我真的需要这个。

我正在尝试订阅频道,就像documented in Parse一样。 但我没有看到我在Core屏幕中添加的频道。我确信版本是正确的。

enter image description here

这是我的代码:

let currentInstallation = PFInstallation.currentInstallation()
    currentInstallation.addUniqueObject("myChannel", forKey: "channels")
    currentInstallation.saveInBackground()

我尝试将"myChannel"添加到数组中,如下所示:

let currentInstallation = PFInstallation.currentInstallation()
    currentInstallation.addUniqueObject(["myChannel"], forKey: "channels")
    currentInstallation.saveInBackground()

我做错了什么?

编辑: 由于 Shubank sujjested我尝试了以下内容:

let currentInstallation = PFInstallation.currentInstallation()
    currentInstallation.addUniqueObject("beybey", forKey: "channels")
    currentInstallation.saveInBackgroundWithBlock { (bool: Bool, error: NSError?) in
        print(bool)
        print(error)
    }

块内的断点未被触发。

1 个答案:

答案 0 :(得分:0)

当前安装在您访问它的地方为零。

可能等待注册令牌以便在创建实例之前访问远程通知