简体   繁体   中英

-ObjC Flag in Xcode Issue

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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM