我正在尝试创建然后检索CLLocationCoordinate2D对象的数组,但由于某种原因,该数组始终为空.
我有:
NSMutableArray *currentlyDisplayedTowers;
CLLocationCoordinate2D new_coordinate = { currentTowerLocation.latitude, currentTowerLocation.longitude };
[currentlyDisplayedTowers addObject:[NSData dataWithBytes:&new_coordinate length:sizeof(new_coordinate)] ];
Run Code Online (Sandbox Code Playgroud)
我也试过这个来添加数据:
[currentlyDisplayedTowers addObject:[NSValue value:&new_coordinate withObjCType:@encode(struct CLLocationCoordinate2D)] ];
Run Code Online (Sandbox Code Playgroud)
无论哪种方式,[currentDisplayedTowers count]总是返回零.什么想法可能会出错?
谢谢!