I try to create Cocoa Touch Static Library
and follow these steps.
- Create New Project with
Cocoa Touch Static Library
named it By default i got single class withDemo.h
andDemo.m
.
2.Create a public function in .h
and implement it in .m
.
3.Select iOS Device
and press cmd + B
.
4.Copy Demo.a
from products and the .h
file drop it in my iOS App
where i want to use it.
5.Then Import Demo.h
and try to call the function that i wrote.
Issue
When try to Run the project showing this error.
ld: warning: ignoring file /Users/Zenga/Documents/iOS/Static Library/myAppwithLib/Demo.a, file was built for archive which is not the architecture being linked (i386): /Users/Zenga/Documents/iOS/Static Library/myAppwithLib/Demo.a
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Demo", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please help if anyone have any idea about it. As these type of error occur if your class' .m file is not listed under the "Compile Sources" but in this case Libraries and I checked Demo.a
is also there.