There’s a bug – it seems – in Xcode 4.3.2 that was causing an issue with my DTBannerManager component. I’m documenting the workaround here and how to recognize that you are experiencing the bug.
DTBannerManger – a component to unite iAds, MobFox and Google AdMob – has a subfolder Externals that contains a clone of the MobFox iOS SDK from GitHub. Since the component only links in the Static Library product of the MobFox Xcode project this is the only file that I had added to my project. No use in adding any other superfluous files, right?
The first symptom of the issue was that you would get a weird ARC-related Warning: “Sending DTBannerManager *const __strong” to parameter of incompatible type “id <MobFoxBannerViewDelegate>”
Well, what do we do if we get a warning on a setDelegate:self? We check the header to see if the class is defined to comply with the protocol. There I found that the <MobFoxBannerViewDelegate> protocol declaration was missing. So we added that plus the import for the header where this protocol is defined.
Here’s a bit of a WTF. Why does it not find the header?
So next I went and checked the search path for the headers. I was pretty sure that this was working as of Xcode 4.3. The header search path is in the build settings:
This is set up correctly. The path from the project root is Core/Externals and the double asterisks mean that it should be searching recursively. And as I said before, this was working perfectly before.
The workaround is quite simple, but it’s not obvious. I only found it out myself after messing around for over an hour with a client who was having the same issue setting up my DTRichTextEditor as sub-project in one of his apps.
You need to add the header that cannot be found to the project, even though it is not associated with any targets. Apparently this is necessary for the Xcode indexer to be able to “see” the header.
That’s all it takes. I hope you remember reading about this workaround if you ever happen to stumble across this Xcode bug. I did so twice so far.
Categories: Bug Reports