我正在使用此代码段http://snipplr.com/view/43115/,我想知道如何访问tag属性以对connectionDidFinishLoading中的数据执行不同的操作?
答案 0 :(得分:1)
是的,但方法的参数是URLConnection类型,而不是CustomURLConnection。如果您知道该对象实际上是CustomURLConnection,则可以重新构建它并提取“tag”属性:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
CustomURLConnection *myconn = (CustomURLConnection *)connection;
NSLog(@"%@", myconn.tag);
NSMutableData *dataForConnection = [self dataForConnection:(CustomURLConnection*)connection];
[connection release];
// Do something with the dataForConnection.
}