diff options
author | Muller, Alexander (A.) <amulle19@ford.com> | 2016-12-09 22:14:56 -0800 |
---|---|---|
committer | Muller, Alexander (A.) <amulle19@ford.com> | 2016-12-09 22:14:56 -0800 |
commit | 44acfae711df56a4b75a101f978c657bd8a1b9fa (patch) | |
tree | ff50b8ced1515fd41c5b6ec3cd49e7152153bcb6 | |
parent | 9700f3c3c361c597771537a008aa73bacae1fea5 (diff) | |
download | sdl_ios-44acfae711df56a4b75a101f978c657bd8a1b9fa.tar.gz |
Fixed issue with waypoints not being correctly initialized as SDLLocationDetails
-rw-r--r-- | SmartDeviceLink/SDLGetWaypointsResponse.m | 13 | ||||
-rw-r--r-- | SmartDeviceLink/SDLOnWaypointChange.m | 12 |
2 files changed, 23 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLGetWaypointsResponse.m b/SmartDeviceLink/SDLGetWaypointsResponse.m index aa5b5d310..3f3f474a4 100644 --- a/SmartDeviceLink/SDLGetWaypointsResponse.m +++ b/SmartDeviceLink/SDLGetWaypointsResponse.m @@ -2,6 +2,8 @@ // #import "SDLGetWaypointsResponse.h" + +#import "SDLLocationDetails.h" #import "SDLNames.h" @implementation SDLGetWayPointsResponse @@ -21,7 +23,16 @@ } - (NSArray<SDLLocationDetails *> *)waypoints { - return parameters[NAMES_waypoints]; + NSMutableArray *array = [parameters objectForKey:NAMES_waypoints]; + if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:SDLLocationDetails.class]) { + return [array copy]; + } else { + NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]]; + for (NSDictionary *dict in array) { + [newList addObject:[[SDLLocationDetails alloc] initWithDictionary:(NSMutableDictionary *)dict]]; + } + return [newList copy]; + } } @end diff --git a/SmartDeviceLink/SDLOnWaypointChange.m b/SmartDeviceLink/SDLOnWaypointChange.m index a18975bc1..60b6fa4a6 100644 --- a/SmartDeviceLink/SDLOnWaypointChange.m +++ b/SmartDeviceLink/SDLOnWaypointChange.m @@ -3,6 +3,7 @@ #import "SDLOnWaypointChange.h" +#import "SDLLocationDetails.h" #import "SDLNames.h" @implementation SDLOnWayPointChange @@ -22,7 +23,16 @@ } - (NSArray<SDLLocationDetails *> *)waypoints { - return parameters[NAMES_waypoints]; + NSMutableArray *array = [parameters objectForKey:NAMES_waypoints]; + if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:SDLLocationDetails.class]) { + return [array copy]; + } else { + NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]]; + for (NSDictionary *dict in array) { + [newList addObject:[[SDLLocationDetails alloc] initWithDictionary:(NSMutableDictionary *)dict]]; + } + return [newList copy]; + } } @end |