{"action":"created","issue":{"url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/62","labels_url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/62/comments","events_url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/62/events","html_url":"https://github.com/smartdevicelink/sdl_ios/issues/62","id":56082618,"number":62,"title":"[SDLRPCMessage initWithDictionary] does not check whether the passed in dictionary is formatted correctly","user":{"login":"jacobkeeler","id":10549248,"avatar_url":"https://avatars.githubusercontent.com/u/10549248?v=3","gravatar_id":"","url":"https://api.github.com/users/jacobkeeler","html_url":"https://github.com/jacobkeeler","followers_url":"https://api.github.com/users/jacobkeeler/followers","following_url":"https://api.github.com/users/jacobkeeler/following{/other_user}","gists_url":"https://api.github.com/users/jacobkeeler/gists{/gist_id}","starred_url":"https://api.github.com/users/jacobkeeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacobkeeler/subscriptions","organizations_url":"https://api.github.com/users/jacobkeeler/orgs","repos_url":"https://api.github.com/users/jacobkeeler/repos","events_url":"https://api.github.com/users/jacobkeeler/events{/privacy}","received_events_url":"https://api.github.com/users/jacobkeeler/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/smartdevicelink/sdl_ios/labels/best%20practice","name":"best practice","color":"8bc34a"},{"url":"https://api.github.com/repos/smartdevicelink/sdl_ios/labels/bug","name":"bug","color":"F44336"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-30T20:46:30Z","updated_at":"2015-07-31T15:51:41Z","closed_at":null,"body":"The `initWithDictionary` function in the `SDLRPCMessage` class assumes that whatever dictionary is passed in is in a specific format. \r\n\r\nAs a result, if a dictionary that doesn't follow this format is passed in, then the function will raise an exception which means nothing to the user.\r\n\r\nFor Example, this exception is thrown when a dictionary containing a single key:value pair is given to the function:\r\n> \"failed: caught \"NSInvalidArgumentException\", \"-[SDLAppInterfaceUnregisteredReason objectForKey:]: unrecognized selector sent to instance 0x7f9dc349e9e0\"\" \r\n\r\nThe function should check whether the dictionary follows the correct format, and return nil or throw an exception describing the problem if it does not."},"comment":{"url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/comments/126731225","html_url":"https://github.com/smartdevicelink/sdl_ios/issues/62#issuecomment-126731225","issue_url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/62","id":126731225,"user":{"login":"jacobkeeler","id":10549248,"avatar_url":"https://avatars.githubusercontent.com/u/10549248?v=3","gravatar_id":"","url":"https://api.github.com/users/jacobkeeler","html_url":"https://github.com/jacobkeeler","followers_url":"https://api.github.com/users/jacobkeeler/followers","following_url":"https://api.github.com/users/jacobkeeler/following{/other_user}","gists_url":"https://api.github.com/users/jacobkeeler/gists{/gist_id}","starred_url":"https://api.github.com/users/jacobkeeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacobkeeler/subscriptions","organizations_url":"https://api.github.com/users/jacobkeeler/orgs","repos_url":"https://api.github.com/users/jacobkeeler/repos","events_url":"https://api.github.com/users/jacobkeeler/events{/privacy}","received_events_url":"https://api.github.com/users/jacobkeeler/received_events","type":"User","site_admin":false},"created_at":"2015-07-31T15:51:41Z","updated_at":"2015-07-31T15:51:41Z","body":"At the moment, there are no tests that fail because of this issue, I just found the issue while I was writing the unit tests for SDLRPCMessage. \r\n\r\nAfter looking more into what causes the error, it appears that the cases where it happens are fairly specific. From what I can tell, it fails whenever there is an entry in the dictionary that does not have a NSDictionary value before the main entry (\"notification\", \"request\", or \"response\"). I am not entirely certain why this is case as of yet.\r\n\r\nExamples:\r\n```objc\r\nDoes Not Crash:    @{NAMES_notification:\r\n                       @{NAMES_parameters:@{@\"param\":@\"val\"},\r\n                         NAMES_operation_name:@\"name\"}}\r\n\r\nCRASHES:           @{\"key\":\"value\", NAMES_request:\r\n                       @{NAMES_parameters:@{@\"param\":@\"val\"},\r\n                         NAMES_operation_name:@\"name\"}} \r\n\r\nDoes Not Crash:    @{\"dict\":@{\"key\":\"value\"}, NAMES_notification:\r\n                       @{NAMES_parameters:@{@\"param\":@\"val\"},\r\n                         NAMES_operation_name:@\"name\"}}\r\n\r\nCRASHES:           @{\"dict\":@{\"key\":\"value\"}, \"key\":\"value\", NAMES_response:\r\n                       @{NAMES_parameters:@{@\"param\":@\"val\"},\r\n                         NAMES_operation_name:@\"name\"}}\r\n\r\nDoes Not Crash:    @{NAMES_request:\r\n                       @{NAMES_parameters:@{@\"param\":@\"val\"},\r\n                         NAMES_operation_name:@\"name\"}\r\n                     \"key\":\"value\"}\r\n```"}}