diff options
author | Muller, Alexander (A.) <amulle19@ford.com> | 2016-09-28 15:16:17 -0700 |
---|---|---|
committer | Muller, Alexander (A.) <amulle19@ford.com> | 2016-09-28 15:16:17 -0700 |
commit | f6b1da6e5336fd9e1346745d30aaab91382658b2 (patch) | |
tree | 42fb8c74bc94f83ec7e21b9b6a51c9e6ca5ef616 /SmartDeviceLink/SDLV1ProtocolMessage.m | |
parent | 4a77f0cf6de1e85027c45490d96dedc023ac7b70 (diff) | |
download | sdl_ios-f6b1da6e5336fd9e1346745d30aaab91382658b2.tar.gz |
Removed SDLJsonEncoder/Decoder.
Diffstat (limited to 'SmartDeviceLink/SDLV1ProtocolMessage.m')
-rw-r--r-- | SmartDeviceLink/SDLV1ProtocolMessage.m | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/SmartDeviceLink/SDLV1ProtocolMessage.m b/SmartDeviceLink/SDLV1ProtocolMessage.m index 736dd0b13..8083b198f 100644 --- a/SmartDeviceLink/SDLV1ProtocolMessage.m +++ b/SmartDeviceLink/SDLV1ProtocolMessage.m @@ -2,10 +2,9 @@ // #import "SDLV1ProtocolMessage.h" -#import "SDLJsonDecoder.h" +#import "SDLDebugTool.h" #import "SDLProtocolHeader.h" - @implementation SDLV1ProtocolMessage - (instancetype)initWithHeader:(SDLProtocolHeader *)header andPayload:(NSData *)payload { @@ -17,7 +16,17 @@ } - (NSDictionary *)rpcDictionary { - NSDictionary *rpcMessageAsDictionary = [[SDLJsonDecoder instance] decode:self.payload]; + if (self.payload.length == 0) { + return nil; + } + + NSError *error = nil; + NSDictionary * rpcMessageAsDictionary = [NSJSONSerialization JSONObjectWithData:self.payload options:kNilOptions error:&error]; + if (error != nil) { + [SDLDebugTool logInfo:[NSString stringWithFormat:@"Error decoding JSON data: %@", error] withType:SDLDebugType_Protocol]; + return nil; + } + return rpcMessageAsDictionary; } |