Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix a project that Interface-Builder fubar'd

Help me un-fubar interface-builder in XCode4.

I created a button in interface-builder and defined an IBAction method for it in the view's code. It ran fine. Then I renamed the button's action method using XCode's refactor / rename tool. It ran fine.

Then I deleted the button in interface-builder by selecting the button and hitting the delete key. When I rebuilt the project the button is still there in the simulator. Back in interface-builder, the button is gone. There is no reference to the button in the code, but the button's IBAction method is still there.

To make matters worse, the button's original action method is getting called which of course throws a runtime exception of selector not found. When I do a project search for name of the original action method nothing is found, but the runtime is still trying to call it. I did a "clean" and rebuild but no joy.

If I try to open the .xib file as ASCII Property list, it tells me the data has been corrupted. (I figured that out.)

Other than deleting the .xib file and creating a new view, is there any way to fix this?

And what does "clean" do if it doesn't delete the binaries?

Thanks for your help!

like image 972
LandedGently Avatar asked May 07 '11 03:05

LandedGently


2 Answers

Try iOS Simulator -> Reset Content and Settings. (To save time, Xcode tries to copy resources before launch only if those resources have changed, but if things have gone screwy…)

like image 94
Jon Reid Avatar answered Oct 24 '22 10:10

Jon Reid


Clean did not work for me. In my experience, Xcode keeps a cache of the "compiled .xib" without regard to timestamps (try switching out a xib for one with the same name). My fix was to modify each view that needed to be refreshed. Very frustrating, but it works.

like image 33
Kyle Avatar answered Oct 24 '22 11:10

Kyle