我一直在使用ASIHTTPRequest
作爲應用程序,但它給我錯誤topSecretFetchFailed
方法5出10個請求,不知道如何處理它,難道ASIHTTPRequest
不夠穩定?iOS中的ASIHTTPRequest
[request setDidFailSelector:@selector(topSecretFetchFailed:)];
編輯:
這是我的代碼或方法,該方法被調用每個請求。 MARKET_INDEXES_URL其具有「someurl.com」的靜態字符串;
- (void)requestData {
ASIHTTPRequest *req = [ASIHTTPRequest requestWithURL:[NSURLURLWithString:MARKET_INDEXES_URL]];
[req setDelegate:self];
[req setDidFailSelector:@selector(topSecretFetchFailed:)];
[req setDidFinishSelector:@selector(topSecretFetchComplete:)];
[self setRequest:req];
[self.request startAsynchronous];
}
,這是失敗的處理程序
- (void)topSecretFetchFailed:(ASIHTTPRequest *)theRequest {
[[NSNotificationCenter defaultCenter] postNotificationName:@"MarketIndexesError" object:nil];
UIAlertView *view = [[UIAlertView alloc] initWithTitle:@"Warning !" message:@"Connection error, Please try again" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[view show];
[view release];
NSLog(@"MarketIndex service Fail: %d %@", [theRequest responseStatusCode], [theRequest responseStatusMessage]);
}
@丹謝謝你的幫助。 – Demones 2011-05-18 04:20:16
@Dan我在我的失敗處理程序中接收statuscode = 0和statusmessage = null,不知道發生了什麼。 – Demones 2011-05-18 04:47:44
@Smin - 我想我們需要看到更多的代碼。 – 2011-05-18 12:00:39