Build error using an Xcode project with OS X target platform and iOS static library target

I am writing a reusable code library designed for both OS X and iOS. I created an Xcode project with two goals. One of the goals is the foundation for OS X. Another is the static library for iOS.

I found that the OS X target builds are trying to use iOS headers. I know this because TARGET_OS_IPHONE is defined, causing the assembly to try to find UIKit.h, etc. This, of course, causes failures for the target framework environment, since the target OS X infrastructure environment is not related to the iOS frameworks.

I checked the build settings for the target OS X environment for goofiness, but found nothing. The base SDK is installed as "Mac OS X 10.6." Note that when I created the Xcode project, I used the Cocoa Framework template and then added the target of the iOS static library.

What else could cause the OS X target platform to use the wrong SDK?

Thanks, -KIRBY

+6
ios xcode macos
source share
3 answers

Your problem is that Xcode is confused. Click the Browse button and reset the Active SDK to the base SDK. You will probably find that the goal of the Mac is set to one of the goals of iOS, which ultimately causes all kinds of fun, as you saw

+1
source share

I had some problems starting up, putting the Mac and iPhone target in the same Xcode project file as what you described in your question and accompanying comment. My solution is to have a separate Xcode project file for Mac and iOS. You can still share files between projects, although you must keep each of them individually updated, but this leads to less severe behavior.

0
source share

I am doing something very similar to what you are describing. I have several private frameworks that are shared between our iOS application and our OS-X application. Each such structure is in its own project with two goals. Mac-OS dynamic structures and the special iOS “static structure” using the special template we added to Xcode is an open-source project by Karl Stenerud iOS universal iOS infrastructure Now I have never experienced the stupidity you describe and I'm sure that it’s just that you mistakenly deleted (or added) to the project / goal settings.

What I recommend as a "debugging method" for project parameters is this.

You have a good text editor. Go to iOS static lib build settings e.g. Select the All and Combined buttons. Now select all the lines and Copy (command-C). Go to a text editor and paste. You will have a good text description of all the settings.

Now create a new template project in Xcode and do the same in another text file. Now compare these files, for discrepancies.

Do it on all three levels. 1. Project level settings 2. Static settings for iOS 3. OS-C frame.

0
source share

All Articles