开发者

Xcode runs code that I deleted

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){  <<--开发者_StackOverflow社区--------- 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


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


Try bounding the conditions more:

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜