1

I am new to iOS programming and Xcode. Please help me understand how does Xcode compile and run the code.

Ideally an IDE knows the changes made in the progranm and the next time when we compile or run it, it knows which files need to be compiled again. But while I was trying to add storyboards in a project which was working fine with a few ViewControllers and XIB files,
I moved the view from an existing xib file to a ViewController in the storyboard and changed the name of the class to its respective ViewController in the Identity Inspector and I deleted the XIB file. When I ran the program, I didn't see anything different happening. Out of curiosity I deleted all the XIB files and then again ran the program but the still the project ran perfectly.

Then finally I deleted all the files present in my project and when prompted to either "Send to Trash" or "Remove References" I chose remove references and again built and ran the application, but there was no problem and again it ran perfectly.

After that I closed the project and again opened the project from the 'Finder' and ran it this time finally I got more than 30 errors which were not resolved even after I added all the files back to the project in Xcode.

Please help me understand how Xcode compiles the projects and also that what I may be doing wrong to move the views in the XIB files to "Storyboard" in a project.

MK Singh
  • 706
  • 1
  • 13
  • 36
  • It would help if you showed what errors were thrown. – Abizern May 16 '13 at 12:54
  • Those were all linker error which were addressing problems in the .o files. Those had come up as I had deleted all the files. Now I know that if I "Clean" a project, I will not face such a problem. But I want to know that if process that I followed to transfer views to Storyboard was correct. – MK Singh May 16 '13 at 13:19

1 Answers1

1

You are right in your understanding that XCode should detect changes and know when to rebuild things, however, XCode is not perfect, and is sometimes buggy. You can "Clean" the project under the Product menu to get it to rebuild.

You did not say if you were running on the simulator or not. I often have problems when adding or removing resources and running on a device. To fix these issues, you can delete the app on the device.

Restarting XCode also often fixes issues.

Also, ensure you have the latest version of XCode.

If you get to the point where you can recreate issues, consider submitting a bug report.

Community
  • 1
  • 1
Marcus Adams
  • 53,009
  • 9
  • 91
  • 143
  • @MKSingh, Apple does fix common and easily re-creatable bugs quickly, but those rare ones still linger. Always submit bugs against the latest version of XCode, otherwise Apple will just reply, "Does it still occur on the latest version?". – Marcus Adams May 16 '13 at 13:02
  • I ran it both on the simulator and the iPhone. – MK Singh May 16 '13 at 13:21