Creating Cocoa Touch Static Library with XCode4

允我心安 提交于 2019-12-10 21:26:01

问题


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.


回答1:


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.




回答2:


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



回答3:


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.)




回答4:


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.



来源:https://stackoverflow.com/questions/5453199/creating-cocoa-touch-static-library-with-xcode4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!