简体   繁体   中英

Creating a Static Library in Xcode 5

Hi guys I'm having a bit of trouble creating a static library in xcode 5. Most of the tutorials out there are done in xcode 4 and thanks to apples incredibly easy to use gui, that makes it so easy for users to transition from one program to another, so I haven't been able to make one and use it. So I get that the first step is to make the cocoa ios static library project and then to add the header and implementation files (.h and .m) that you want in your library. Next you supposed to set the header files that you want to be accessible by the user. Is it possible to set up the library in such a way that importing one header file also imports all of the other header files? Do the other header files need to be public to do this? My main problem is how do I actually set the classes which I want to be public/private and finally how do I implement this library into one of my applications? A HelloWorldLibrary example would be great!


After using the link: github.com/jverkoey/iOS-Framework

I am now having a problem with the locating of the Framework:

ld: warning: directory not found for option '-L/Users/Harry/Library/Developer/Xcode/DerivedData/SampleFramework-efznryzmlxnimoaaazjfbqjirzxq/Build/Products/Debug-iphoneos'
ld: framework not found SampleSubproject

在此处输入图片说明

There are steps to create static library.

I have not created in xCode 5, but have created in 4.x..

  • Create new project and select Cocoa touch static library under iOS.
  • Add Class files/Resources to your created project.
  • Set Installation Build Products Location to $(BUILT_PRODUCTS_DIR)
  • Copy headers in Build Phases
  • Set headers to Public in Target Membership
  • Build for Archiving/Profiling
  • got it from derived data (Release iphonesimulator, Release-iphoneos)
  • now merge both .a files using

lipo command from terminal like lipo -create libForDevice.a libForSimulator.a -output UniversalLib.a

  • Now copy this lib to your main xCode project and include your perticular class.

You can find more details from here

Regards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM