为了发送 HTTP 请求,我使用 NSURLConnection 如下:
NSURLConnection *connection = [[NSURLConnection alloc]
initWithRequest:request
delegate:self
startImmediately:YES];
在 connectionDidFinishLoading 结束时,我需要发布不同的通知,具体取决于刚刚完成的 HTTP 请求。但是,在 connectionDidFinishLoading 内部,我对发送的请求类型没有明确的逻辑标识符:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
// here i want to post various notifications, depending on the HTTP request that was completed
}
这里最好的解决方案是什么?谢谢!