7

I have a release target and a test target, I want to change the name of the release target, but if I do so I start getting a linking error in the test target. As they are unit tests I didn't think there would/should be a dependency within the test target to the release target, but apparently there is. The linkage error is:

ld: file not found: /Users/Cequint/Library/Developer/Xcode/DerivedData/XYZ-apppviisyaexwpdcwgjtfldjotro/Build/Products/Debug-iphonesimulator/XYZ.app/XYZ
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1

XYZ.app is the name of the release target before I renamed it.

Is there an automatic or quick way of updating the unit test target so that it keeps in step?

Gruntcakes
  • 37,738
  • 44
  • 184
  • 378
  • This appears to be in the simulator. Make sure you run "Reset Content and Settings" from the iOS Simulator menu to clear it's cache first. – Rayfleck Jan 27 '12 at 17:38
  • The linker error is still there after doing that - but now its changed to not being able to find XYZRenamed.app. (I build the app first) – Gruntcakes Jan 27 '12 at 17:49
  • I don't know how but I got it to work. I've noticed Xcode seems a bit buggy in terms of residual things not clearing properly when they should, and I think this is a manifestation of that. – Gruntcakes Jan 27 '12 at 18:52
  • @Woofbeans Please either post your solution as an answer and accept it, or delete this Q as others will keep coming here trying to solve it when it's no longer an issue. – Basic Feb 09 '12 at 15:19

2 Answers2

0

Depending on how the unit test target was added, you may or may not have a build dependency in the test target to the app target. I would check there first in targets->test target->build phases->target dependencies. I would think XCode would automatically update that but you never know...

One more place to look for targets is in the unit test targets build scheme, where you should see the test target (plus optionally the project target itself, as I have a dependency on it in my personal test project).

Another place to test the reset method mentioned by others above is to go to the organizer, select projects, then 'delete...' all the derived data for the project in question.

shawnwall
  • 4,549
  • 1
  • 27
  • 38
0

Probably a bit late with this answer, but I experienced this same issue (Xcode 6.3) and figured out a fix:

  1. Go into the Project Inspector and select the unit test target Locate the Test Host value (it will be something like $(BUILT_PRODUCTS_DIR)/MyOldAppTargetName.app/MyOldAppTargetName)
  2. Edit the Test Host value to reflect the new app target name (something like $(BUILT_PRODUCTS_DIR)/MyNewAppTargetName.app/MyNewAppTargetName

I have filed this as http://www.openradar.me/21139630 and rdar://21139630 with Apple. Feel free to dupe if you also experience this issue.

Andrew Ebling
  • 10,175
  • 10
  • 58
  • 75