2012-02-15 2 views
0

몇 가지 코드로 시작하겠습니다. 응용 프로그램이로드, 그것은 다음과 같은 호출 할 때 :NSURLConnection의 보증 주문

//Creates custom URL for request, loads the request, and upon completion (as per the delegate response, it runs the selector) 

//List of programs 
URLCreator * getListURL = [[URLCreator alloc] initStandard:@"getList"]; 
WebManager *getListWM = [[WebManager alloc]init]; 
[getListWM load:[getListURL finalURL] withSelector:@selector(createProgramList)]; 

//Sorting order for program list 
URLCreator * getSortURL = [[URLCreator alloc] initStandard:@"getSort"]; 
WebManager *getSortWM = [[WebManager alloc]init]; 
[getSortWM load:[getSortURL finalURL] withSelector:@selector(sortThroughPrograms)]; 

이 코드는 지금까지 잘 한 가지를 제외하고 작동 - 내 반응은 순서가 온다. 이는 프로그램 목록이 정렬 순서보다 훨씬 크기 때문에 예상됩니다. 기본적으로, 어떤 종류의 정렬 알고리즘을 수행하기 전에 프로그램 목록과 정렬 순서가 있음을 보장해야합니다.

동기 요청을 수행하여 프로그램을 잠그지 않고 정렬 알고리즘을 수행하기 전에 내가 가지고있는 것을 보장하는 가장 좋은 방법은 무엇입니까? 물론 BOOL 플래그를 설정할 수는 있지만 항상 수신 확인을해야합니다.

답변