Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

xcode

macos

ios

I'm writing a library of reusable code intended for both OS X and iOS. I created an Xcode project with 2 targets. One target is a framework for OS X. The other is a static library for iOS.

I discovered that builds of the OS X framework target are trying to use the iOS headers. I know this because TARGET_OS_IPHONE is defined causing the build to attempt to find UIKit.h, etc. This of course causes builds for the framework target to fail since the OS X framework target does not link to iOS frameworks.

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

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

Thanks, -KIRBY

like image 967
Kirby T Avatar asked Jan 28 '11 12:01

Kirby T


People also ask

Is XCFramework static or dynamic?

An XCFramework can be either static or dynamic and can include headers.

What is the difference between project and target in Xcode?

An project is a repository for all the files, resources, and information required to build one or more software products. A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace.

Where is build settings in Xcode?

Choose the project in the Project Navigator on the left. Select the Configurations target from the Targets section and click the Build Settings tab at the top. The Build Settings tab shows the build settings for the Configurations target. It's possible to expand this list with build settings that you define.


1 Answers

Your issue is that Xcode's gotten confused. Option click on the Overview popup and reset your Active SDK to Base SDK. You'll probably find that the Mac target is set to one of the iOS targets, which ends up causing all sorts of hilarity as you've seen

like image 102
Mike Shields Avatar answered Sep 27 '22 17:09

Mike Shields