打静态库所出现的问题以及解决方法


1.静态库中包含了Category(分类)

如果静态库中包含了Category,有时候在使用静态库的工程中会报“方法找不到”的错误(unrecognized selector sent to instance

解决方案:在使用静态库的工程中配置Other Linker Flags为-ObjC

 

2.IOS编译报错:objc-class-ref in AppDelegate.o之解决方案

|2015-01-23 09:50 |14695人阅读

xcode6.0升级到xcode6.1后,程序编译报错,错误如下:这是个很常见的错误,很多项目在更换xcode版本后,都会出现类似的问题。

Undefined symbols for architecture x86_64:

  "_OBJC_CLASS_$_QQApiInterface", referenced from:

      objc-class-ref in AppDelegate.o

  "_OBJC_CLASS_$_ShareSDK", referenced from:

      objc-class-ref in AppDelegate.o

      objc-class-ref in RecipeDetailViewController.o

      objc-class-ref in showViewController.o

      objc-class-ref in video_show.o

  "_OBJC_CLASS_$_TencentOAuth", referenced from:

      objc-class-ref in AppDelegate.o

  "_OBJC_CLASS_$_WXApi", referenced from:

      objc-class-ref in AppDelegate.o

  "_OBJC_CLASS_$_WeiboApi", referenced from:

      objc-class-ref in AppDelegate.o

  "_OBJC_CLASS_$_YXApi", referenced from:

      objc-class-ref in AppDelegate.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

解决方案:

Xcode升级到6.1.1 默认让所有App都通过64位编译器编译。原来在Xcode6.0的时候默认的Architectures只有(arm7,armv7s),到6.1.1默认就带上arm64的参数了。


 

把build active architectures only 改为 NO。

2. 把最下面的Valid Architectures中的arm64参数删掉就可以了

   或者:

双击Architectures,选择other,删除$(ARCH_STANDARD),然后增加armv7和armv7s(写上:$(ARCHS_STANDARD_32_BIT))。

3.clean 再build。

结果设置如下图:

目前设置完成后,问题顺利解决,大家有更好的解决方案,欢迎讨论!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM