2012-04-27 57 views

回答

1

是的,但該方法的參數是URLConnection類型,而不是CustomURLConnection。如果您知道該對象實際上是CustomURLConnection,則可以重新投射它並提取「標記」屬性:

- (void)connectionDidFinishLoading:(NSURLConnection *)connection { 
    CustomURLConnection *myconn = (CustomURLConnection *)connection; 
    NSLog(@"%@", myconn.tag); 

    NSMutableData *dataForConnection = [self dataForConnection:(CustomURLConnection*)connection]; 
    [connection release]; 

    // Do something with the dataForConnection. 
} 
+0

非常感謝!這很好。 – user1279526 2012-04-27 20:07:42