編輯:我遇到的問題是,我使用TapKu日曆,所以我依靠提供的代表。這裏是problm:如何暫停/停止功能,直到SOAP請求完成
- (NSArray*) calendarMonthView:(TKCalendarMonthView*)monthView marksFromDate:(NSDate*)startDate toDate:(NSDate*)lastDate{
//SOAP Request has NSURLConnection which runs asychonrous delegate methods.
//SOAP Request will return before the data array has been populated
[self SOAPRequest:startDate];
//i need to do something like this, however the SOAPRequest will return and get stuck into the loop instead of the asychronos delegates firing
//therefore i can never set bGettingData to NO.
int iWait;
while (bGettingData) {
iWait++;
}
return dataArray;
}
你好,
在應用程序中,我創造,我靠SOAP請求來檢索數據,解析XML和填充數組。
我的問題是,當我檢查數組是空的,因爲SOAP請求尚未完成。我如何阻止我的代碼執行直到SOAP請求完成並恢復代碼?這可以通過回調或線程完成嗎?
感謝