You can use helper class for accessing array in different class. Create an NSObject file in the project. I've named it Passing Class
In your PassingClass.h
#import <Foundation/Foundation.h>
@interface PassinClass : NSObject
{
NSMutableData *dataResponsetoPass;
}
+(PassinClass*)sharedString;
-(void)setdataResponsetoPass:(NSMutableData*)data;
-(NSMutableData*)getDataResponse;
In your PassinClass.m
#import "PassinClass.h"
@implementation PassinClass
@synthesize dataResponsetoPass;
static PassinClass*sharedString;
+(PassinClass*)sharedString
{
if(!sharedString)
{
sharedString=[[PassinClass alloc]init];
}
return sharedString;
}
-(void)setdataResponsetoPass:(NSMutableData*)data
{
dataResponsetoPass=data;
}
-(NSMutableData*)getDataResponse;
{
return dataResponsetoPass;
}
In your class1.h create instance of this helper class.
#import "PassinClass.h"
{
PassinClass*pClass;
}
In your class1.m, set the data using
pClass=[PassinClass sharedString];
[pClass setdataResponsetoPass:Your Data];
In your class2.m get the data using
pClass=[PassinClass sharedString];
[pClass getDataResponse];
NSLog the [pClass getDataResponse ]
to check, if everything went well you should be able to pass the response data from class 1 to class 2.