145

I have an app that works with and without the linker flag. However, without the linker flag, I get a very different behaviour when adding data to a view.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
bsarrazin
  • 3,990
  • 2
  • 18
  • 31

1 Answers1

164

This flag causes the linker to load every object file in the library that defines an Objective-C class or category. While this option will typically result in a larger executable (due to additional object code loaded into the application), it will allow the successful creation of effective Objective-C static libraries that contain categories on existing classes.

From this Technical Q&A

sergio
  • 68,819
  • 11
  • 102
  • 123
  • 2
    Great! Thank you. Is this caused by the fact that we are using GCC 4.2 as a compiler? Would using LLVM GCC 4.2 or LLVM Compiler 2.0 solve the problem? Or am I mixing up stuff that shouldn't be mixed? – bsarrazin Jul 08 '11 at 20:25
  • I think that the behavior is the same with both compilers (besides, I don't know if there are 2 different linkers)... – sergio Jul 08 '11 at 20:35
  • 4
    Does this mean that you would never need `-ObjC` in anything other than a library / SDK? I.e. you should never need to use it in an actual app target? – Robert Feb 24 '14 at 15:20
  • 3
    No, this means you need -ObjC in any project implementing a library that has a category or embedded framework in it – arc4randall Jan 08 '16 at 00:20
  • Just found this out the hard way! – Alexandre G Feb 09 '16 at 08:07