임무를받을 수는 있지만 임무마다 순서가 다릅니다. 각 작업마다 동일한 작업 목록 순서가 있어야합니다. 내가 지금 가져 오는 방법Google Tasks for 루프를 사용하여 API를 가져 오는 중입니다.
, 내가 작업 타이틀 작업 목록 제목과 행에 대한 섹션 제목을 사용하는 작업을 제시 jQuery과에
GTLServiceTasks *service = self.taskService;
query = [GTLQueryTasks queryForTasklistsList];
self.taskListsTicket = [service executeQuery:query
completionHandler:^(GTLServiceTicket *ticket,
id taskLists, NSError *error) {
//i get the count of Tasklists here
GTLTasksTaskList *itemtemp;
for (int k=0; k<count_of_tasklists; k++) {
NSMutableArray *alist = [[NSMutableArray alloc] init];
//i get the id and titles of the tasklists here
GTLServiceTasks *service2 = self.taskService;
query2 = [GTLQueryTasks queryForTasksListWithTasklist:itemtemp.identifier];
self.taskListsTicket = [service2 executeQuery:query2
completionHandler:^(GTLServiceTicket *ticket2,
id taskLists2, NSError *error2) {
self.taskLists = taskLists2;
for (int j=0; j<[self.taskLists.items count]; j++) {
//i get tasks for each tasklist here and store each one of
//the tasklists as a nsmutablearray
}
[tasks addObject:alist];
//i add each tasklist array to the master array
// then call reload method of the uitableview here
}];
}
}];
. 각 작업에서 올바른 작업이 올바른 섹션 아래에 표시됩니다.
내 문제는 작업 목록 (섹션 순서)의 순서는 각 실행에서 내 uitableview와 GTL 응답의 콘솔 로그 모두에서 다릅니다. 나는 for 루프가 Google API 호출의 결과를 기다리지 않고 동작한다고 생각한다. 문제에 대한 아이디어가 있습니까? 미리
고맙습니다