xcode 4 fails to initiate unit tests (with linker error) after I created a new scheme

前端 未结 6 1871
星月不相逢
星月不相逢 2020-12-23 20:06

My unit tests worked fine in xcode4 until I had to create a new schema to compile a package to run on my device for testing.

All I did was creating a new Target an

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-23 20:24

    I tried everything (including the other answers and those noted here http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/), but finally found a different solution:

    Set Deployment Postprocessing (in the Deployment section of Build Settings) to NO for the Debug target.

    Before I did this, the executable was being stripped, and the link would fail with

    Undefined symbols for architecture i386:
      "_OBJC_CLASS_$_SomeClassUnderTest", referenced from:
          objc-class-ref in SomeTest.o
    

    No matter that Strip Linked Product and Strip Debug Symbols During Copy were set to NO, it made no difference - only changing the Deployment Postprocessing setting finally made sure that the symbols were not stripped.

提交回复
热议问题