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.
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.
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
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:
(Sorry, Grab captured the tool tip, but not the mouse cursor - I hope you can see the icon I mean anyway.)
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.
精彩评论