Xcode 4: ipa's and static libraries
A common problem when you integrate a static library or framework into your Xcode project is losing the option to generate an ipa package.
This can be pretty annoying if you have a client breathing down your neck chasing you up for the latest ad hoc build for them to test and show their friends.
I myself came across this very problem when I first used route-me within one of my applications inside Xcode4. With a tiny bit of detective work I managed to figure out how to configure the project correctly.
The first logical place for me to look for any problems that may cause Xcode to disable the ipa option was to dig inside the application itself. I generated the archive file, located it inside of Finder, right clicked and selected show package contents.
After digging around it became obvious that Xcode could not generate the ipa package because of header files used by the static frameworks not being built into the application. You can see in the screenshot below that there are two header files included in the include folder.
Now that i knew what the problem was, the next job was to figure out how to tell Xcode that these files should be packaged up in the application, so that it was possible to generate an ipa.
Xcode has a setting in a Targets Build Settings called skip install which if set to YES, will tell Xcode to place any static library files into the build folder with everything else when it is generating an archive, instead of keeping the libraries files in their local directory structures.
To find skip install navigate to a targets Build Settings, you will then find skip install inside of the Deployment heading.
Completing this step i thought i would be good to go, although attempting to build the ipa again, Xcode was still not letting me select the ipa option. The answer lay within the build phases settings for the included frameworks. If you remember from earlier on in this post, we had two problem header files not being built into the package.
Selecting Build Phases it became immediately obvious how to fix the problem, the problem header files were located under the Public copy headers heading. This caused Xcode to see the files as public and not integrated into the project, to fix this it was a simple case of dragging the files from the public heading into the project heading.
This fix along with setting the framework to Skip Install solved all of the problems in regards to generating an ipa package and voila i was then able to generate the ipa and send it off to the client. If you ever come across this same problem, remember to set Skip Install to YES and then check your Build Phases settings for any renegade header files not included in the project.