VandyApps / vandyvans-ios

Vandy Vans Project for iOS
8 stars 3 forks source link

Crash when running on iOS 7.1, iPhone 5 #31

Closed rnc505 closed 10 years ago

rnc505 commented 10 years ago

I'm getting a crash running the current master branch on my iPhone 5 running iOS 7.1. All I'm doing is running in debugging and I'm getting a SIGABRT. Here's the stack trace:

2014-05-06 22:56:55.885 Vandy Vans[6667:3503] *** Terminating app due to uncaught     exception 'NSInvalidArgumentException', reason: '-[__NSCFArray     objectForKeyedSubscript:]: unrecognized selector sent to instance 0x165bfa20'
  *** First throw call stack:
   (0x2f5caf03 0x39d5fce7 0x2f5ce837 0x2f5cd12f 0x2f51c0d8 0x277ab 0x56657       0x3a248d53 0x3a24d25f 0x3a24e689 0x3a24e8dd 0x3a379c17 0x3a379adc)

screen shot 2014-05-06 at 10 59 24 pm

It doesn't seem to like this line (29):

CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake([coordinateResponseArray[i][@"Latitude"] doubleValue]

It appears that the object at coordinateResponseArray[i] is an NSArray, not an NSDictionary.

If I type po coordinateResponseArray[0] into the debugger, this is the output:

 <__NSCFArray 0x16698ec0>(
 {
     Latitude = "36.1407773092093";
     Longitude = "-86.80675506591797";
 },
 {
     Latitude = "36.13820397291261";
     Longitude = "-86.80718421936035";
 },
 {
     Latitude = "36.13754546252029";
     Longitude = "-86.80072546005249";
 },
 ...........
 {
     Latitude = "36.14065600905717";
     Longitude = "-86.80678725242615";
 }
 )

However, if I run in the Simulator this doesn't happen, although the app doesn't pop up in the debugger in the simulator for some reason, I have to click it to open it.

sethfri commented 10 years ago

@rnc505 Thanks for this catch; it looks like this crash happens the first time you run the app on a device. Looks like Syncromatics changed their response JSON so that the array is double wrapped, so we'll need to alter the code to fix this. I'll get a fix pushed; luckily this crash shouldn't affect anyone before this Saturday when the Vandy Vans stop running for the year.