I’ve defined two @interfaces in a .h file for my iPhone app project and would like to use a NSMutableData object defined in one @interface in the other. Is this possible / how would I go about doing it?
Thanks!
Here’s what my code looks like. The reason I have to add another delegate for the NSConnection is because this is the second connection being made (I haven’t shown the code for the first connection).
@implementation SecondNSDownloadDelegate
@synthesize responseData;
@synthesize test;
- (void)connection:(NSURLConnection *)connection didReceiveResponse:
(NSURLResponse *)response {
NSLog(test) <-- gives null(), this is the problem.
[self.responseDataYears setLength:0];
}
@end
@implementation ViewController
@class ViewController;
@class AnotherViewController;
@synthesize responseDataYears;
@synthesize test;
- (void)getAvailableYears {
NSString *test = @"test";
secondNSConnecterDelegate = [[SecondNSDownloadDelegate alloc] init];
[[NSURLConnection alloc] initWithRequest:[NSURLRequest
requestWithURL:[NSURL URLWithString:@"data_url"]]
delegate:secondNSConnecterDelegate];
}
@end
Create a reference to the other interface:
then, somewhere in the implementation for B, access the data using
Tim