sharvey
sharvey

Reputation: 8145

Creating Cocoa Touch Static Library with XCode4

When creating a Cocoa Touch Static Library with XCode4, the .a file in the Products groups appear red and building doesnt fix this. Then, when adding this project to another project in the same workspace with Build Phases/Link Binary With Libraries, the build fails at linking. Any pointers?

Edit: It looks like a problem with anything I build with XCode4, because no matter what project I build, the content of Products appears in red.

Upvotes: 3

Views: 2805

Answers (4)

anish
anish

Reputation: 11

XCODE 4.x builds .a files in respective directory - below is description of release build for simulator and iphone

There was no modification to project settings during the output

/Users/userName/Library/Developer/Xcode/DerivedData/projectName-uniqueIdentifier/Build/Products/Release-iphoneos

/Users/userName/Library/Developer/Xcode/DerivedData/projectName-uniqueIdentifier/Build/Products/Release-iphonesimulator

replace below values -

userName = change userName to current user
projectName-uinqueIdentifier = project name followed by unique identifier

Upvotes: 1

cduhn
cduhn

Reputation: 17918

I experienced the same bug in Xcode 4. Try building the project for the device. Once I did that once, the build product turned black and I could then build for the simulator or device without issues. You may also need to re-add the libraries to your dependent project.

Upvotes: 1

Alec Sloman
Alec Sloman

Reputation: 287

Looking at the comments, I'm a little confused. It sounds like you have successfully built the library, but maybe you haven't got a static build yet? Because that's what you'll want if you're trying to link it to another project. If that's the case, then you need to run the scheme that includes the static library target first. Then it will appear, and then you can link it to another project.

Upvotes: 0

Sherm Pendley
Sherm Pendley

Reputation: 13612

When the product name is in red, that indicates it wasn't built successfully. Check the "issues" pane to see what the problem was. The triangle & exclamation point icon will bring it up, as shown here:

enter image description here

(Sorry, Grab captured the tool tip, but not the mouse cursor - I hope you can see the icon I mean anyway.)

Upvotes: 0

Related Questions