#import
@interface MyStaticLibraryDemo : NSObject
/// 加法
- (int)addMethodByFirst:(int)theFirst andSecond:(int)theSecond;
/// 减法
- (int)SubMethodByFirst:(int)theFirst andSecond:(int)theSecond;
@end
#import "MyStaticLibraryDemo.h"
@implementation MyStaticLibraryDemo
/// 加法
- (int)addMethodByFirst:(int)theFirst andSecond:(int)theSecond{
}
/// 减法
- (int)SubMethodByFirst:(int)theFirst andSecond:(int)theSecond{
}
@end
bogon:~ zhangzhen$ cd /Users/zhangzhen/Library/Developer/Xcode/DerivedData/MyStaticLibraryDemo-ciwnhcsbqgclkododazbmbmt
bogon:Release-iphoneos zhangzhen$ lipo -info libMyStaticLibraryDemo.a
Architectures in the fat file: libMyStaticLibraryDemo.a are: armv7 armv7s arm64
bogon:~ zhangzhen$ cd /Users/zhangzhen/Library/Developer/Xcode/DerivedData/MyStaticLibraryDemo-ciwnhcsbqgclkododazbmbmt
bogon:Release-iphonesimulator zhangzhen$ lipo -info libMyStaticLibraryDemo.a
Architectures in the fat file: libMyStaticLibraryDemo.a are: i386 x86_64
MyStaticLibraryDemo *myLibrary=[[MyStaticLibraryDemo alloc] init];
ld: warning: ignoring file /Users/XXXX/Documents/MyLibraryTest/MyLibraryTest/MyLibrary/libMyStaticLibraryDemo.a, missing required architecture i386 in file/Users/XXXX/Documents/MyLibraryTest/MyLibraryTest/MyLibrary/libMyStaticLibraryDemo.a (3 slices)
Undefined symbols for architecture i386:
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
bogon:~ zhangzhen$ lipo -create /所在路径/Release-iphoneos/libMyStaticLibraryDemo.a /所在路径/Release-iphonesimulator/libMyStaticLibraryDemo.a -output /Users/zhangzhen/Desktop/libUniversal.a
bogon:~ zhangzhen$
本文详细介绍了如何在iOS开发环境中创建并使用静态库文件。包括建立静态库项目、编写功能函数、编译不同版本的静态库及如何在项目中正确引入使用。同时,还讲解了如何合并真机和模拟器版本的静态库。









131

被折叠的 条评论
为什么被折叠?



