agilemonkeys/meets-ios — pull request #3 by dotjim (2014-04-24 12:18:32+00:00)
Title: Fix to MGProducts throwing an exception when fetching a single product v...

Fix to MGProducts throwing an exception (trace below) when fetching a single product via `makeProductWithId` and `fetchWithCompletion`.

MGProducts.m `(id)getModelFromResponse:(id)responseObject` method could receive two types of NSDictionaries with product information, for a single product request (via `makeProductWithId` and `fetchWithCompletion`) this is a simple hash of product keys and values, however for a collection (e.g. via `makeProductCollection` and `fetchWithCompletion`) this is a multidimensional hash of productId and product dictionary hash. Only the latter type was supported.

```
2014-04-24 12:04:33.012 App[25631:60b] -[__NSCFString objectForKeyedSubscript:]: unrecognized selector sent to instance 0xb462a80
2014-04-24 12:04:33.015 App[25631:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKeyedSubscript:]: unrecognized selector sent to instance 0xb462a80'
*** First throw call stack:
(
0 CoreFoundation 0x026a21e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01d3c8e5 objc_exception_throw + 44
2 CoreFoundation 0x0273f243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0269250b ___forwarding___ + 1019
4 CoreFoundation 0x026920ee _CF_forwarding_prep_0 + 14
5 App 0x0008c023 -[MGProducts mapResponseToModelObjectWithResponse:] + 111
6 App 0x0008bec1 -[MGProducts getModelFromResponse:] + 480
7 App 0x00096d71 __50-[RestApiMethod runWithParams:filters:completion:]_block_invoke + 48
8 App 0x0005e727 __55-[AFHTTPSessionManager GET:parameters:success:failure:]_block_invoke + 94
9 App 0x00073651 __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_288 + 156
10 libdispatch.dylib 0x02ccd7b8 _dispatch_call_block_and_release + 15
11 libdispatch.dylib 0x02ce24d0 _dispatch_client_callout + 14
12 libdispatch.dylib 0x02cd0726 _dispatch_main_queue_callback_4CF + 340
13 CoreFoundation 0x0270743e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
14 CoreFoundation 0x026485cb __CFRunLoopRun + 1963
15 CoreFoundation 0x026479d3 CFRunLoopRunSpecific + 467
16 CoreFoundation 0x026477eb CFRunLoopRunInMode + 123
17 GraphicsServices 0x0445a5ee GSEventRunModal + 192
18 GraphicsServices 0x0445a42b GSEventRun + 104
19 UIKit 0x009fcf9b UIApplicationMain + 1225
20 App 0x0001a49d main + 141
21 libdyld.dylib 0x02f17701 start + 1
)
```