I'm doing a call to an API in my AppDelegate.m didFinishLauncingWithOptions
method. The JSON retrieved will be translated into an NSArray
of objects. I'd like to set a property of my first view controller to that array so that view controller can use the latitude
and longitude
properties of those objects to map out locations.
Something like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// array retrieved - in actual application, this is an API call and translation
Obj *object1 = [[Obj alloc] init];
Obj *object2 = [[Obj alloc] init];
Obj *object3 = [[Obj alloc] init];
NSArray *arrayOfObjectsToMap = [NSArray arrayWithObjects:object1, object2, object3, nil];
// pass object array along to first view controller
firstController.objectList = arrayOfObjectsToMap;
return YES;
}
I'm having trouble figuring out how to set properties on the first controller, which was created in Storyboard. The self.window.rootViewController
of the AppDelegate is of type UIViewController
and my initial controller is of type MapViewController
with an NSArray
property akin to the objectList
property in the example above.