我有一个带有LiveQuery的解析服务器。
我可以通过日志info: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");
}];发布于 2016-10-20 01:02:43
正在运行的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")
}https://stackoverflow.com/questions/39360601
复制相似问题