2016-09-07 2 views
0

J'ai un serveur d'analyse avec un LiveQuery.Analyser LiveQuery ne fonctionne pas

Je peux me connecter à la requête en direct par les informations de journal: Create new client: 1, et websocket.org confirme la connexion, mais aucun des blocs d'achèvement n'est en cours d'appel.

Voici le code complet:

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"); 
}]; 

Répondre

1

Code Swift 3.0 qui fonctionne:

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") 
    } 
+0

vous utilisez les gousses? –

+0

Comment intégrez-vous avec swift 3? Il y a beaucoup de dépendances. –

+2

@ AsadullahAli oui: pod 'ParseLiveQuery', git: 'https://github.com/parseplatform/ParseLiveQuery-iOS-OSX', branche: 'fix-object-decoding' – protspace