iOS常见的第三方库(framework)导入错误

一般我们导入他人封装好的类有时会出现一些bug,会让我们这些新手则特别头疼;

1、
Undefined symbols for architecture i386:
"_SCNetworkReachabilityCreateWithAddress", referenced from:
"_SCNetworkReachabilityGetFlags", referenced from:

解决方法:添加SystemConfiguration.framework

2、这个是引用NSDataAdditions时出现的bug,
"_deflate", referenced from:
-[NSData(NSDataAdditions) gzipDeflate] in NSDataAdditions.o
"_deflateEnd", referenced from:
-[NSData(NSDataAdditions) gzipDeflate] in NSDataAdditions.o
"deflateInit2", referenced from:
-[NSData(NSDataAdditions) gzipDeflate] in NSDataAdditions.o
"_inflate", referenced from:
-[NSData(NSDataAdditions) gzipInflate] in NSDataAdditions.o
"_inflateEnd", referenced from:
-[NSData(NSDataAdditions) gzipInflate] in NSDataAdditions.o
"inflateInit2", referenced from:
-[NSData(NSDataAdditions) gzipInflate] in NSDataAdditions.o

解决方法:添加libz.dylib

3、'libxml/HTMLpraser.h' file not found
这个是一位网友在xcode4.3.2中编译没问题,但是在xcode4.6.3中编译是遇到的,给的解决步骤:

-添加libxml2.2.dylib类库
-在Build Settings->Other Liner Flags此项中添加-lxml2,如下图:


145608_nWJ0_735123.jpg

-在Build Settings->Header Search Paths项添加/usr/include/libxml2,如下图

iOS常见的第三方库(framework)导入错误_第1张图片
145827_rEYy_735123.jpg

据这位网友讲,修复过后报错armv7s,armv7s的问题比较常见的解决办法是在Build Settings->Valid Architectures项中去除armv7s,如果还是未能解决,请谷歌armv7s查找具体解决办法PS:用第三方类库.a文件时很容易出现无法解决的armv7s问题,尤其是好多类库都比较老,但是苹果的类库和XCode一直在更新,很容易出现未知错误,建议用第三方库时导入.m文件,比较容易解决问题

4、selector警告
“performSelector may cause a leak because its selector is unknown”

触发原因
SEL sel = @selector(touch:);
[self performSelector:sel withObject:textField];

解决方法:

#######import

SEL sel = @selector(touch:);
objc_msgSend(self, sel, textField);
// textField为touch:后跟的参数,如有多个参数,用','连接即可

如果还有别的bug欢迎各位码友指出一起学习
本文根据【芳仔小脚印】博客http://my.oschina.net/joanfen/blog/150271
学习后记录!

------------------------------------

你可能感兴趣的:(iOS常见的第三方库(framework)导入错误)