【问题标题】:Parse LiveQuery not working解析 LiveQuery 不起作用
【发布时间】:2017-01-14 14:17:53
【问题描述】:

我有一个带有 LiveQuery 的 Parse 服务器。

我可以通过日志信息连接到实时查询:Create new client: 1,并且 websocket.org 确认连接,但是没有调用任何完成块。

这里是完整的代码:

self.pfclient = [[PFLiveQueryClient alloc] init];
PFQuery* query = [PFQuery queryWithClassName:@"Reqs"];
[query whereKey:@"objectId" notEqualTo:@"asdfas"];
self.subscription = [self.pfclient subscribeToQuery:query];

[self.subscription addSubscribeHandler:^(PFQuery * _Nonnull query) {
    NSLog(@"Subscribed");
}];

[self.subscription addUpdateHandler:^(PFQuery * _Nonnull query, PFObject * _Nonnull obj) {
    NSLog(@"Update");
}];

[self.subscription addErrorHandler:^(PFQuery * _Nonnull query, NSError * _Nonnull error) {
    NSLog(@"Error");
}];

【问题讨论】:

    标签: ios parse-platform parse-server livequery


    【解决方案1】:

    正在运行的 Swift 3.0 代码:

    let liveQueryClient = ParseLiveQuery.Client(server: "...", applicationId: ..., clientKey: ..)
    

    ...

    var subscription: Subscription<PFObject>?
    
    let query: PFQuery<PFObject> = PFQuery(className: "className").whereKey("objectId", equalTo: "168sdf8438")
    
    subscription = liveQueryClient.subscribe(query).handle(Event.created) { _, message in
                print("Object created")
        }
    

    【讨论】:

    • 你在使用 pod 吗?
    • 如何与 swift 3 集成?有很多依赖关系。
    • @AsadullahAli 是:pod 'ParseLiveQuery',git:'github.com/parseplatform/ParseLiveQuery-iOS-OSX',分支:'fix-object-decoding'
    • 哇,我已经挣扎了好几个星期了。谢谢你,我的男人。我猜旧的 ParseLiveQuery 似乎在连接到 AWS 和 Heroku 时出现问题。
    • 当你写:...你的意思是我们自己完成这些参数?
    猜你喜欢
    • 2016-05-22
    • 2012-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多