2

I deleted large sections of code and Xcode still runs it.

I did the following to try and alleviate the problem:

  • Restart Xcode
  • Unplug the iPod
  • Build: Clean
  • Build: Clean all targets

Nothing has changed

Appreciate your help... thanks.

an example:

for(int i = 0; i < 5; i++){
    if (i==4){
        //eventA
    }
    else{
        //eventB
    }
}

eventB eventB eventB eventB eventA

will produce the same result as:

for(int i = 0; i < 5; i++){
    if (i==777){  <<----------- note the change
        // deleted eventA
    }
    else{
        //eventB
    }
}

eventB eventB eventB eventB eventA

however, I get what is expect here:

for(int i = 0; i < 5; i++){
    if (i==4){ <<----------- placed the 4 back
        // deleted eventA
    }
    else{
        //eventB
    }
}

eventB eventB eventB eventB

1
  • Did you delete the app on the iPod?
    – Hot Licks
    Jul 6, 2011 at 20:32

3 Answers 3

4

Are you sure you edited the file you think you did? Perhaps you edited a copy from another folder?

9
  • Very sure since there is only one instance. Jul 6, 2011 at 20:32
  • Also I can delete the whole page of code. Run it so nothing works. Put the code back in and get the same deleted code executing again. Jul 6, 2011 at 20:34
  • @Kristen Martinson: And there's no superclass that implements the same method ?
    – DarkDust
    Jul 6, 2011 at 20:44
  • @DarkDust ... No, I have code within condition statements that were deleted that are executing. Jul 6, 2011 at 20:45
  • silly question, but did you rebuild the app after you cleaned and etc? Jul 6, 2011 at 20:50
1

Try bounding the conditions more:

for(int i = 0; i < 5; i++){
    if (i==4){ 
        //eventA
    }
    else if (i < 4){ <<-------bounding the else
        //eventB
    }
}
0
0

Go to /Users/USERNAME/Library/Developer/Xcode/DerivedData/ and delete everything inside the directory. In the simulator click iOS Simulator > Reset Content and Settings.... If your code is still getting executed, it is because it is getting compiled again, and there must be a silly mistake somewhere, like you executing the wrong target or something.

3
  • I don't have a "Library/Developer" or anything resembling what comes after. Jul 6, 2011 at 22:50
  • Weird. Go to XCode > Preferences > Locations. Right at the top it should say "Derived Data (index, logs, build) Location". There will be a path and a little arrow. Click the little arrow to open Finder on that location. That is the place where XCode builds your application. If you delete the contents, you are left with just your source code.
    – Jano
    Jul 6, 2011 at 23:04
  • Aah yes, that's it then. Well, it won't be long before you migrate to 4 I suppose, next time you know what to do to discard XCode errors. :)
    – Jano
    Jul 7, 2011 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.