10 Jan 15
19:06

Xcode: Semi-stale libraries and the simulator

xcode plays dirty when updating .a

xcode plays dirty when updating .a

Edit: (2/8/2014) As usual, I’m an idiot – this problem was caused by having explicit linker library search path flags (e.g. -LTo/My/Old/AdMobDir) that took precedence over the new libs I added. It didn’t matter that I removed the old ones from the Xcode and git, because they were (oddly) specifying an external directory that had a copy of the same libs. I’ll leave this post up to remind myself about this, at the expense of my credibility.

Today it is my birthday, so I thought how fun it would be to update AdMob for an iOS app. Since it’s just .a and .h files, it would be doable in under a minute. But after updating, I still got the message:

2015-01-10 20:40:24.194 Noise[13472:10630180] You are currently using version 6.5.1 of the SDK, which doesn’t officially support iOS 8. Please consider updating your SDK to the most recent sdk version, 6.12.2, to get iOS 8 support, including a fix for smart banner rendering in landscape mode. The latest SDK can be downloaded from http://goo.gl/iGzfsP. A full list of release notes is available at https://developers.google.com/mobile-ads-sdk/docs/admob/ios/rel-notes.

I did rebuilds after each of these steps: clean, deleted the old libGoogleAdMobAds.a of the same name from my source control, removed libGoogleAdMobAds.a from link phase (error’d as expected), re-added it, all to no avail – the simulator build was still showing the same message.

Then I remembered deleting the app from the simulator has historically fixed certain issues (stale app icon/xibs/etc), so I tried that. Worked like a charm.

I think I’ve seen this issue before – but the only way I knew that stale libs were the cause of it was because of the log message. Since upgrading a library usually will support the same old symbols, there generally won’t be a linker error – so this could potentially waste important debugging time with the programmer incorrectly believing he is debugging the newest version of the lib.

I hope and believe that the issue is just in the transfer of the project and ‘overly-clever’ optimization of transferring the app to the simulator that missed a diff case, because the deleting trick worked. Perhaps the transfer diffs only non-linked code – although, I would expect it to include statically linked stuff and only have this issue for dynamic linkage. This took around 15 minutes of messing around to figure out, but it seems like something that could bite back in the future.

Update: I tried this same project on another mac and my iPhone and found that the deprecated message was still there, just deferred, so this post may not be a correct solution. It’s possible that the message itself is bad, but I’m not sure yet. To check my sanity, I did these steps: git fetch/merge to update to the new admob libs (while the project was closed). The problem was different here – it persisted even after cleaning/rebuilding and deleting the app from the device. I restarted Xcode on a hunch, and also tried nuking the derived data folder.