NSMutableArray addobject with malloc'd struct
问题 I'm having trouble with a snippet of code. I'm trying to add an instance of CLLocationCoordinate2D to a NSMutable array using the addObject method, but whenever the line is executed, my app crashes. Is there anything obvious wrong with this code? The crash is on this line: [points addObject:(id)new_coordinate]; Polygon.m: #import "Polygon.h" @implementation Polygon @synthesize points; - (id)init { self = [super init]; if(self) { points = [[NSMutableArray alloc] init]; } return self; } -(void