0

I have an NSMutabaleArray with few contents, and want to copy the contents to another array in another class, the code:

sandboxcontroller.h:

@interface SandboxViewController : UIViewController
{

NSMutableArray * arrayOfDesc;
}

@property (nonatomic, retain) NSMutableArray * arrayOfDesc;

SandboxContoller.m

@synthesize arrayOfDesc;

[arrayOfDesc addObject:[[CLLocation alloc] initWithLatitude:location.coordinate.latitude longitude:location.coordinate.longitude]];

the class in with i want to copy: NVMapViewController.h

@interface NVMapViewController : UIViewController <MKMapViewDelegate> {
MKMapView *_mapView;
SandboxViewController * sandboxViewController;
NSMutableArray * points;
}

@property (nonatomic, retain) SandboxViewController *sandboxViewController;

NVMapViewController.m

points = [[NSMutableArray alloc] initWithArray:sandboxViewController.arrayOfDesc] ;

When i log the points array, it gives me null. Where is there problem, can anyone suggest me, thanks.

And im not using ARC.

2
  • 1
    Is sandboxViewController actually set to something when you do the assignment to points? Commented Mar 29, 2012 at 12:28
  • yes, log sandboxViewController as well Commented Mar 29, 2012 at 12:35

1 Answer 1

1

Here is where you can get the solution:

iPhone SDK: How do I pass an array of values from a ViewController onto other ViewController?

There you can refer to Satya's answer.

Let me know if you need more help

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.