I am attempting to copy an array in my ViewController to a Data storage class. None of the array copy methods I have found are actually working. Currently I have..
//XML parser is returning an array of parsed objects
NSMutableArray *randomtesting = [parser listArray];
customerList.list =[[NSMutableArray alloc] initWithArray:randomtesting copyItems:YES];
NSLog(@"First node randomtesting: %@",[randomtesting objectAtIndex:0]);
NSLog(@"First node customerList: %@",[customerList.list objectAtIndex:0]);
The first NSLog prints out the value correctly. The second prints out a Null. I have also tried
customerList.list =randomtesting;
and
customerList.list = [paser listArray];
The .h of my Viewcontroller for this class is as follows
#import <UIKit/UIKit.h>
@class CustomerListData;
@interface ViewController : UIViewController <UIAlertViewDelegate, UITextFieldDelegate>{
CustomerListData *customerList;
}
@property (nonatomic, retain) CustomerListData *customerList;
The class's .h of the array variable is
#import <Foundation/Foundation.h>
@interface CustomerListData : NSObject{
NSMutableArray *list;
}
@property (nonatomic, retain) NSMutableArray *list;
@end
the .m is just
@synthesize list;
I believe all of my variable declarations are correct, I'm just not copying it correctly. But I none of the methods seem to work.
Thanks.