how can create static library , can add .a file on project in ios.
i tried doing couldn't it.
thanks in advance
if want create static lib mean refer link http://jaym2503.blogspot.in/2013/01/how-to-make-universal-static-library.html
step 1 : create new project, named "logger"
step 2 : create classes
you can create many classes wants, in our tutorial create 1 class named "logger". so, 2 files should in our resource. 1. logger.h 2. logger.m
step 3 : put useful code classes
step 4 : create new target
create new target file menu.
new target select cocoa touch static library
step 5 : add files compile resource
select "logger" target of static library go build phases in complied sources section, add .m , .mm files. in copy files section, add .h files , resource files.
build phases
step 6 : compile project static library target
compile project ios device compile project simulator can find 2 different .a files generated in build folders.
find .a file
step 7: make static library universal
you can find 2 different library now, 1 simulator , 1 ios devices.
create new folder , name loggermerge. copy liblogger.a
file of debug-iphoneos folder "loggermerge" rename liblogger_device.a copy liblogger.a
file of debug-iphonesimulator folder "loggermerge" rename liblogger_simulator.a open loggermerge folder terminal fire below command lipo -create "liblogger_simulator.a
" "liblogger_device.a
" -output "liblogger.a
"
now, can find liblogger.a in loggermerge folder, universal static library file. now, 1 thing need headers, see above screenshot there folder called include in both build folder. copy header file folder.
step 8 : test static library
create new project, name testlogger import liblogger.a
, header files import header file "logger.h
" anywhere want use now, use logger class default practice. in our case, [logger log:@"test string"]; run project in simulator , device both that's it!! have own static library!!
Comments
Post a Comment