I\'m trying to save a location and retrieve the location on a map afterward using Core Location, MapKit and Core Data frameworks.
What I\'ve done is I just made entity
You don't need to use NSNumber to store latitude and longitude points. You can store CLLocation directly to core data instead.
Set up an entity for each CLLocation, it'll be a too-many relation off whatever entity is using location points. Let's call this LocationPoint:
class LocationPoint: NSManagedObject {
@NSManaged var game: NSNumber
@NSManaged var time: NSDate
@NSManaged var location: AnyObject
}
You then set the location property to transformable in the Xcode data model. That's it!
In Objective-c you can actually still declare this LocationPoint property as CLLocation without any errors:
@property (nonatomic, strong) CLLocation *location
More info here.