NSMutableArray of ClLocationCoordinate2D

前端 未结 5 968
遇见更好的自我
遇见更好的自我 2020-12-16 11:27

I\'m trying to create then retrieve an array of CLLocationCoordinate2D objects, but for some reason the array is always empty.

I have:

NSMutableArray         


        
5条回答
  •  余生分开走
    2020-12-16 12:08

    For anyone else with this issue, there's another solution if you are planning on using MapKit.

    (The reason I say IF, of course, is because importing a module such as MapKit purely for a convenient wrapper method is probably not the best move.. but nonetheless here you go.)

    @import MapKit;
    

    Then just use MapKit's coordinate value wrapper whenever you need to:

    [coordinateArray addObject:[NSValue valueWithMKCoordinate:coordinateToAdd]];
    

    In your example..

    [currentlyDisplayedTowers addObject:[NSValue valueWithMKCoordinate:new_coordinate]];
    

提交回复
热议问题