2015-08-10 2 views
0

Я использую Azure Mobile Service в качестве моего приложения. Я пытаюсь синхронизировать данные, как указано в демо-версии Azure «TodoItem». Каждая вещь работает нормально, но только данные не извлекаются из удаленного сервера. (. Методы invokeAPI)PullWithQuery не возвращает данные с удаленного сервера

Я использую пользовательский API

Вот мой код:

[self syncData:^
{ 
    // Let the caller know that we finished 
    if (completion != nil) { 
     dispatch_async(dispatch_get_main_queue(), completion); 
    } 
}]; 

-(void)syncData:(QSCompletionBlock)completion 
{ 
    // push all changes in the sync context, then pull new data 

    [self.client.syncContext pushWithCompletion:^(NSError *error) { 
     [self logErrorIfNotNil:error]; 
     [self pullData:completion]; 
    }]; 
} 

-(void)pullData:(QSCompletionBlock)completion 
{ 


    // Pulls data from the remote server into the local table. 
    // We're pulling all items and filtering in the view 
    // query ID is used for incremental sync 

    NSPredicate * predicate = [NSPredicate predicateWithFormat:@"complete == NO"]; 
    MSQuery *query = [self.syncTable queryWithPredicate:predicate]; 

    [self.syncTable pullWithQuery:query queryId:nil completion:^(NSError *error) { 
     [self logErrorIfNotNil:error]; 

     // Let the caller know that we have finished 
     if (completion != nil) { 
      dispatch_async(dispatch_get_main_queue(), completion); 
     } 
    }]; 
} 

Здесь ничего сохраняются в локальной базе данных с сервера.

ответ

0

Dont pass queryId как ноль.

Пропустите некоторую строку, как показано ниже.

[self.syncTable pullWithQuery: queryId запроса: @ "allitems" завершение:^(NSError * ошибка) {}

Смежные вопросы