开发者

-ObjC Flag in Xcode Issue

开发者 https://www.devze.com 2023-01-04 18:03 出处:网络
I am trying to build a simple iPhone app that calls several static libraries. However, it seems when I include the linker flag \"-ObjC\" and \"-all_load\" (as I need to for one library), it causes the

I am trying to build a simple iPhone app that calls several static libraries. However, it seems when I include the linker flag "-ObjC" and "-all_load" (as I need to for one library), it causes the linker error:

ld: duplicate symbol
_OBJC_METACLASS_$_ASIFormDataRequest in /Users/XXXXX/Projects/AppName/Dependencies/Library1/lib1Kit.a(ASIFormDataRequest.o) and /Users/XXXXX/Projects/AppName/Dependencies/Library2/lib2Kit.a(ASIFormDataRequest.o)

When I remove the flag(s), the linker errors above disappear, but I get:

-[UIView height]: unrecognized selector sent to instance 0x13fe90

Has anyone seen this error and how开发者_JAVA技巧 it is related to -ObjC and/or -all_load? I am at a loss, so any help would be appreciated.

Thanks, Brett


The two errors are orthogonal.

The duplicate symbol error is because you have the same class defined in two separate static libraries. Remove it from one and the error will go away (removing it may be tricky, but not seeing your source that is impossible to tell).

The unrecognized selector error is most likely because you aren't managing memory correctly and have an object that is being freed prematurely. Run with Zombie detection enabled and it'll likely tell you what object is being prematurely released. Better yet, build all your code with Build and Analyze and fix the memory management errors identified first.

0

精彩评论

暂无评论...
验证码 换一张
取 消