-- iOS (iPhone)
XCode static library 생성
어린왕자악꿍
2012. 11. 22. 14:21
1. XCode로 Cocoa Touch Static Library 프로젝트를 생성
File > New > Project
Choose a template for your new project:
iOS > Framework & Library > Cocoa Touch Static Library
Product Name : TestLibrary
2. Helloworld 함수 생성
[TestLibrary.h]
@interface TestLibrary : NSObject
+ (void) Helloworld;
@end
[TestLibrary.m]
@implementation TestLibrary
+ (void) Helloworld
{
NSLog(@"helloworld");
}
@end
3. 플랫폼별 빌드
iOS Device를 선택하고 빌드 후, iPhone x.0 Simulator를 선택하고 빌드
4. 플랫폼별 빌드파일 포함된 라이브러리 생성
터미널에서
SHELL> cd /Users/(유저명)/Library/Developer/Xcode/DerivedData/TestLibrary-xxxxxxxxxxxx/Build/Products
SHELL> libtool Debug-iphoneos/libTestLibrary.a Debug-iphonesimulator/libTestLibrary.a -o /Users/(유저명)/libTestLibrary.a
5. 테스트 프로젝트에서 라이브러리 사용
TestLibrary.h, libTestLibrary.a를 테스트 프로젝트에 import
[TestLibrary Helloworld];