1

This is driving me crazy...

I have been using Google Maps SDK for iOS for a while (even in an App Store product). Now, I cannot make it run in the iOS simulator any longer! It doesn't matter which project I try to run (even the sample code from the SDK), it will always crash the first time a map is added, e.g.:

self.view = [GMSMapView mapWithFrame: frame camera: camera];

This is the log messages I get:

2013-05-16 10:59:01.047 SDKDemos[939:1303] ADDRESPONSE - ADDING TO MEMORY ONLY: http://dl.google.com/geosdk/latest
2013-05-16 10:59:01.050 SDKDemos[939:1b03] Google Maps SDK for iOS version: 1.2.2.3031
2013-05-16 10:59:01.050 SDKDemos[939:1b03] New version of Google Maps SDK for iOS available: 1.3.0.3430
2013-05-16 10:59:01.111 SDKDemos[939:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'

I have lately tried an antivirus SW on this mac, so one theory is that it may have blocked some vital Google Maps data from downloading. Now, I have uninstalled this anti-virus SW, removed Xcode's DerivedData and reset the iOS Simulator, but with the same disappointing result.

All projects I have tried are working perfectly fine when I run them on my iPhone. I have also another mac where everything works fine on the simulator. So clearly something must have happened with this particular machine.

Any advice?

Update

Initially, I focused entirely on the first warning message (ADDRESPONSE - ADDING TO MEMORY ONLY: http://dl.google.com/geosdk/latest), but I have now realised that the only purpose of the URL mentioned there is to download a string with the latest SDK version number (currently "1.3.0.3430"). Since the SDK then correctly prints that string two lines further down, I find it very unlikely that this line is related to the real cause of the crash. (I have changed the title of this question accordingly.)

Magnus
  • 857
  • 1
  • 10
  • 27
  • The question has already been answered here: http://stackoverflow.com/questions/12547490/log-messages-i-didnt-asked-for-in-xcode-4-5-with-ios-6-0 – tigloo May 16 '13 at 09:53
  • Nope. That answer is not solving my problem. Note that there must be some specific cache problem with this machine, since I run exactly the same source code on another machine without running into this problem. So I will need a way to clear up any caches, etc., that Xcode (or the iOS simulator) is using on this machine. – Magnus May 16 '13 at 10:00
  • Do you get a callstack when it crashes (in a debug build)? – Saxon Druce May 17 '13 at 00:32
  • Yes, I do get a callstack. I haven't got it at hands right now, since I am traveling (it's my iMac I have troubles with). Anyway, the pattern is always the same: It crashes in the first "+mapWithFrame:camera:" method, then drills down through about 10 layers of internal Google methods before it crashes. The final error message is always the one shown in my question: `*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil` Do you think I can draw any conclusions from the callstack without access to Google's source code? – Magnus May 17 '13 at 07:54
  • The method names might reveal something. Eg based on the callstack at https://code.google.com/p/gmaps-api-issues/issues/detail?id=4752, I guessed that the problem was with the OpenGL context, and so I figured out a work around. The method names for your crash might not be as helpful though. – Saxon Druce May 19 '13 at 06:50
  • @SaxonDruce Now it just works again! See the answer I have added. Thanks for your efforts to help me! – Magnus May 20 '13 at 10:40

1 Answers1

0

Hard to say if this really qualifies as an answer... In any case, I'd like to document the outcome of this, in case someone else stumbles upon the same problem in the future:

After having been away a couple of days, I returned today, turned on my iMac, made a new test run, and...

The problem was gone! Everything just worked as expected!

I have not changed a single line of code or anything at all in the Xcode configuration. The only thing I did was to once again delete Xcode's DerivedData and reset the simulator (which I did numerous times last week, but without success at that time).

I guess that my assumption must have been right, that there must have been a cache somewhere in my machine, but outside Xcode´s DerivedData, that caused this problem. Then I was away a couple of days, and this cache simply timed out!

Even if this may sound a bit far-fetched, I cannot think of another reason for this weird behaviour.

It would have been really useful to know where this cache is located, so that one could clean it up without needing to shut down the mac for some days!

Magnus
  • 857
  • 1
  • 10
  • 27