2

Short problem description:

XCode 4.2 install right Target on device, but debug (run) always only one of them.

Preconditions:

XCode 4.2 on MAC, iPad as target device

I have two Targets: PRO & FREE. They both:

  • have different info.plist file (set in build settings)

enter image description here

  • have different bundle id, different icons and different prefix headers

  • have different schemes (autocreated)

enter image description here

Problem:

I can't debug FREE version, because it is always run PRO version. I follow steps:

1) Switch to FREE. Clean build. Run. It install FREE version, but failed to run it.

enter image description here enter image description here

2) Switch to PRO. Clean build. Run. It install PRO version and run it OK.

3) Repeat step 1. Now there are no errors, but it run PRO version instead of FREE.

If I trying do the same in Simulator instead of real device, the problem the same, except that there are no error message in step 1, but progress bar shows: "Attaching to Dictionary" (it never ends).

Mike Keskinov
  • 11,614
  • 6
  • 59
  • 87

1 Answers1

0

I figured out, that I have to do following steps EVERY TIME I switch between targets to throughly solve the problem:

  1. clean the project

  2. restart mac (sometimes just restart xcode helps, but not always)

  3. restart device

This is very annoying and time-wasting, but it is only solution I found.

If I didn't do one of this steps, I run into one of following:

  1. The features of Paid and Free version mixed up (skipped step 1)
  2. The app installs right, but MAC can't run app at all, or run wrong version of app (skipped step 2 or 3).
Mike Keskinov
  • 11,614
  • 6
  • 59
  • 87
  • same issue here, I thought I had it fixed with option-command-r but a day later that is not behaving deterministicly. – mattorb Jul 02 '12 at 20:18
  • 1
    2 1/2 years later, this is still a problem. When two or more targets have the same product name, Xcode seems to choose randomly between them when resolving dependencies, despite being very explicit about which target is being linked. Fix your damn bugs, Apple. – Eric apRhys Dec 07 '14 at 22:08
  • Feels like I'm experiencing this issue at the end of 2017 using Xcode 9 – Anton Tyutin Nov 22 '17 at 12:37
  • Same thing in 2019 with Xcode 11.2.1. I have two targets and an app delegate class for each target. If I switch to a scheme that uses the other target and run on a simulator, it will run the wrong delegate class. (Sometimes this happens; sometimes it doesn't.) Fortunately, it seems to work fine if I clean the build folder first OR if I run on an iPhone. Why is this hard, Apple? – ScottyB Nov 30 '19 at 13:36