I have defined a property in application delegate.h and synthesized it in delegate.m file to make it global and to assign and to get its value from entire application:
@property (strong, nonatomic) NSArray *accountsList;
In mainviewcontroller I am assigning NSArray *accounts value to this global value like this:
((VektorAppDelegate *)[UIApplication sharedApplication].delegate).accountsList = accounts;
And in pickerviewcontroller I am assigning its value to another array like:
accountsArray = ((VektorAppDelegate *)[UIApplication sharedApplication].delegate).accountsList;
And then assign it to a picker view as:
- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
return [accounts count]; //Thread 1: Program received signal: "SIGABRT"
}
Now here at this point I point I get an error and my application is crashing, sometimes it works and sometimes it gives error. I am not getting what would be the issue.
I’ve got an idea… Make a method to check if both array’s are equal. So something like
If it NSLog’s correctly, you’re screwed… But if it doesn’t, then it just means you aren’t correctly initializing your array.