Ios 编码器出错
您好,我正在我的Ios 编码器出错,ios,google-maps,core-data,google-maps-sdk-ios,nscoding,Ios,Google Maps,Core Data,Google Maps Sdk Ios,Nscoding,您好,我正在我的ios应用程序中使用GoogleMaps,我必须在CoreData中保存地图标记位置。我正在使用代码 GMSMarker *marker = [GMSMarker markerWithPosition:position]; marker.map = _mapView; [waypoints_ addObject:marker]; NSDictionary *routeDict = [[NSDictionary alloc] initWithObjectsAndKeys:
ios
应用程序中使用GoogleMaps
,我必须在CoreData
中保存地图标记位置。我正在使用代码
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.map = _mapView;
[waypoints_ addObject:marker];
NSDictionary *routeDict = [[NSDictionary alloc] initWithObjectsAndKeys:
waypoints_ ?: [NSNull null], routeName,
nil];
id delegate = [[UIApplication sharedApplication] delegate];
self.managedObjectContext = [delegate managedObjectContext];
NSManagedObjectContext *context = [self managedObjectContext];
Route *routeInfo = [NSEntityDescription
insertNewObjectForEntityForName:@"Route"
inManagedObjectContext:context];
routeInfo.routeName = routeName;
routeInfo.wayPoints = routeDict;
但该应用程序在保存到核心数据时崩溃。
我有个例外
-[GMSMarker encodeWithCoder:]: unrecognized selector sent to instance 0xac72940
2014-05-14 12:31:50.053 Routes[4087:a0b] *** -[NSKeyedArchiver dealloc]: warning: NSKeyedArchiver deallocated without having had -finishEncoding called on it.
2014-05-14 12:31:50.057 Routes[4087:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GMSMarker encodeWithCoder:]: unrecognized selector sent to instance 0xac72940'
GMSMarker
不响应encodeWithCoder:
,因此无法将其放入随后将被编码的词典中(这是在核心数据中将词典设置为属性时发生的情况)
您应该只在核心数据中存储基础数据航路点,然后在请求时从该航路点重建UI