Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

peacetrain67

macrumors member
Original poster
Dec 20, 2007
68
0
I am going through a crisis. I developed an app for two days, and accidently deleted my MainWindow.xib thinking it was a different .xib. After that, iPhone Simulator can't launch anything involving MainWindow.xib, even in different projects. The code that seems to trigger the problem is:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
LoginViewController *_loginViewController = [[LoginViewController alloc] initWithNibName:mad:"LoginView" bundle:[NSBundle mainBundle]];
self.loginViewController = _loginViewController;
[_loginViewController release];
[window addSubview:[loginViewController view]];

That could basically makes the application open to the LoginView.XIB opposed to the MainWindow.XIB. Whenever I try to run an app with that code, I get a "iPhone Application -NameOfAppHere- Crashed Unexpectedly" error as soon as the app *tries to open. I think that has to do with some data not being removed in new applications (an icon shows up although I havent assigned one in the .plist yet, leaving me to think that information is still stuck on my computer). I say still because I ran the uninstall through terminal for xcode then donwloaded/installed the new beta one. I dont know what to do, but am willing to do just about anything to get back on track here - this problem has ruined hte last 24 hours for me.
 
Let's get an important word out of the way first: Backup.
[I would kiss my Time Capsule every so often if I could reach it easily!]

Deleting the MainWindow.xib is a bit of a daft thing to do, but I suspect you are not the only one to do it. I did it once last year when in the early throws of learning. At least you won't do that again.

What I can't understand is why deleting it from this project would upset other projects. When I did it, I simply copied a MainWindow file from a new project and that sorted it for me. [Admittedly, I hadn't got too far at that stage.]

As far as I am aware MainWindow starts everything, regardless of where you direct your views after loading. It strikes me that your problem is in the code, not that you deleted MainWindow. Are your classes and resources added to this specific project correctly? Check the targets on them all.

Clean all of the targets, save and reset the simulator before trying a build again.
 
Clean all of the targets, save and reset the simulator before trying a build again.

Well, just for the record I meant to delete a different .XIB I decided against using. I wasn't paying too close attention.

I just cleaned all of the targets, saved, and am going to try to recompile the app now to get to the same point that always causes the crash. I 'll get back to you in a few minutes, but I am encouraged by the fact that in the iPhone Simulator the icon (for the first time since the incident) is just the default white opposed to the previous icon under the app name that was causing trouble. I am on the edge of my seat now that I may have an answer :eek:

Three words: version. control. system.

Do you care to elaborate? For the record I'm running the beta 3.1 SDK (But got the same error on 3.0, I just upgraded to 3.1 after uninstaller the developer files through terminal. System 10.5.7? I'm not sure what you mean by control, but I'm willing to do what it takes to get this figured out. I am ridicolously aggravated right now, so just please tell me what I need to do.
 
Do you care to elaborate? For the record I'm running the beta 3.1 SDK (But got the same error on 3.0, I just upgraded to 3.1 after uninstaller the developer files through terminal. System 10.5.7? I'm not sure what you mean by control, but I'm willing to do what it takes to get this figured out. I am ridicolously aggravated right now, so just please tell me what I need to do.

Version control is essentially a fancy backup scheme that developers use. It has nothing to do with the versions of software you are using. It just refers to the fact that it allows a team to work with multiple versions of files/projects.

Personally I use Versions (a Subversion client app) along with Beanstalk (www.beanstalkapp.com) as my host. But in reality this is all overkill for the level you are currently at, and just some regular Time Machine style backup will do wonders for you.
 
I don't think using subversion is overkill. Personally, I just use the command line client. XCode does support subversion integration too, so you can do everything straight from XCode.

peacetrain67 - not using version control, or even regularly backing up is asking for trouble. Do yourself a favour, setup subversion and check in OFTEN. I'll generally checkin several times a day at least.
 
I would concur that version control now is so easy to set up, that it is not overkill at all for even a small project.

I use git. Others like svn. But whatever it is, as others said, commit early and commit often.

We've all made mistakes and need to go back an hour or a day or a week or figure out what the hell we were thinking here or there. Git or svn will save your butt in situations like that.
 
Even though version control works partially as a backup system, it's much more powerful than that, especially when working as a team of developers.

So I gotta comment on this whole "commit early, commit often". That's not really the purpose of a version control system, because then you are treating it solely as a backup system. You should only be committing when your code is at a point that you feel comfortable that you're willing to share it with the rest of the development team. This includes having unit-tested your changes. If you start just committing often with no consideration for the rest of the developers, they are going to quickly become less-than-happy with you "breaking the code" constantly. Minor milestones are good points for commitment time.

Also, in the case of the original issue, if you haven't yet committed, it is easier to retrieve the file you accidentally deleted, than if you had already committed.
 
Is there a decent / free version control app for OS-X? Something along the lines of SourceSafe where you can point it to a server and then have multiple user accounts? I haven't really looked, but this story makes me think it might be worth it. :D
 
I use Subversion. Many Xcode developers do also.

It's open source/free. It comes built-in either with Xcode or the OS, not sure which but you already have it. Xcode has built-in support for it. There are also third party stand-alone apps that can be used with Subversion. You can set it up to run on a single computer or with a server.

I don't have any real complaints with Subversion. There are bugs in the Xcode integration but they're not a show-stopper for me.

If you have any intention of publishing an app on the app store you should really be using version control.
 
OK, well I have tried several different things to get the app to run with that code in (even made some new apps and added the code into those only to receive the same result). I appreciate the help guys but nothing is working, so I'm pulling out the last stop. I'm reinstalling my osx clean, not specifically cause of this. I am running low on space and would love to start off like I just got this (I am backing up the essentials, but am looking forward to the chance to change some of the stuff I have been to lazy to on my mac for the last year). I am going to be furious if this doesn't work though, because I know that a fresh install doesn't necessarily get rid of all the data on my mac, and since this little bug has lasted through different file names, uninstallations of xcode, and countless restarts, I still have to keep my fingers crossed that it actually does work. Heres to a MBP running as quick as it once did!

*I'll be back in a little bit at the very least to update if it worked, as well as to check out the backup options you guys have given me. I understand where people are coming from saying that is overkill for someone as much of a novice as me, but if there is one thing to turn someone off of developing, it has to be restarting from scratch so frequently, so I know I'll start backing up.
 
So I gotta comment on this whole "commit early, commit often". That's not really the purpose of a version control system, because then you are treating it solely as a backup system. You should only be committing when your code is at a point that you feel comfortable that you're willing to share it with the rest of the development team. This includes having unit-tested your changes. If you start just committing often with no consideration for the rest of the developers, they are going to quickly become less-than-happy with you "breaking the code" constantly. Minor milestones are good points for commitment time.

That's why more and more people use git. Because you can commit early and often without disrupting anyone else. It's not just using it to backup, it's about segmenting your work into a series of actions that you can reference independently, merge as needed, share as needed, etc.

Whenever you are ready you can push (or pull or email) a whole series of commits at once to others. Or even fold a series of commits into one big one. Or split a big one into one or more. Or just push a single fix that you happened to make in some other part of the code (not specifically related to whatever feature you happen to be working on at the time) Or pretty much anything else you want to do.
 
That's why more and more people use git. Because you can commit early and often without disrupting anyone else.
So, you can commit changes without anyone else seeing them when they resync? Sorry, don't know much about git. More familiar with rcs, cvs, perforce and subversion.
 
I am beyond frustration. I restored my whole mac, and NOW Xcode quits unexpectedly at launch? It may have to do with safari 4 (as I have read all over the place), or the fact I'm running beta 3.1 (It could be a combination), but either way I am so frustrated. I am uninstalling Xcode (for the fourth time in the last 2 days) right now, and am planning on installing 3.0 after, but I really have no confidence that a difference will come. :confused::confused::confused::confused::confused::confused::confused::confused::confused::confused::confused::confused: Help me?!?
 
So, you can commit changes without anyone else seeing them when they resync? Sorry, don't know much about git. More familiar with rcs, cvs, perforce and subversion.

Git is a distributed VCS; it's completely decentralized. When you commit, you are commiting to your own local repository. You can then push those changes to another copy of that repository somewhere else; it could be a single server (so you can use git in a centralized way) or you could push and pull between individual developer machines.

You can also do lots of fine-grained commits within git and squash those down later, in fact, as everything is stored in your local repository you can go back and amend commits, break them up, squash them together and do all kinds of things as long as you follow one golden rule: only modify things you haven't shared with anybody else.
 
So, you can commit changes without anyone else seeing them when they resync? Sorry, don't know much about git. More familiar with rcs, cvs, perforce and subversion.

Yes, for those systems you are right, you have to be careful about commits. And you have to more conservative about branching also, which I think really affects code quality.

I know Linus Trovalds is known for hyperbole sometimes, but seriously a few months with git and you do realize he's right when he says svn is "stupid". :)

You should check it out.
 
I am beyond frustration. I restored my whole mac, and NOW Xcode quits unexpectedly at launch? It may have to do with safari 4 (as I have read all over the place), or the fact I'm running beta 3.1 (It could be a combination), but either way I am so frustrated. I am uninstalling Xcode (for the fourth time in the last 2 days) right now, and am planning on installing 3.0 after, but I really have no confidence that a difference will come. :confused::confused::confused::confused::confused::confused::confused::confused::confused::confused::confused::confused: Help me?!?

It sounds to me like you've taken a sledgehammer out to solve this problem.

Now I guess you have to reinstall Xcode. But next time try a lighter touch?
 
It sounds to me like you've taken a sledgehammer out to solve this problem.

Now I guess you have to reinstall Xcode. But next time try a lighter touch?

well, even after the restore and getting the kink out that was causing xcode to not launch, i still havent figured out the solution for the original problem (although i am managing to work around it now, which is proving to be a frequent hassle).
 
well, even after the restore and getting the kink out that was causing xcode to not launch, i still havent figured out the solution for the original problem (although i am managing to work around it now, which is proving to be a frequent hassle).

Well, did you recreate the MainWindow.xib?
 
Just curious, have you checked Console.app to see if your logs shed any light on the situation? I'm new to the thread and may have missed something, but I have a hard time believing that deleting one MainWindow.xib file could cause all these problems. I'm not questioning anyone, but sometimes the console can answer problems more quickly than anything else.

Luke
 
...and do all kinds of things as long as you follow one golden rule: only modify things you haven't shared with anybody else.
Huh? This statement confuses me. Care to elaborate? Wouldn't it be impossible to have a team of developers working on the same code base if you can't modify something you have shared with others.
 
Huh? This statement confuses me. Care to elaborate? Wouldn't it be impossible to have a team of developers working on the same code base if you can't modify something you have shared with others.

Maybe we should start a new thread to discuss Git?

So in a nutshell commits are just little patches. So let's say I'm working on some stuff and I have commits E through H that I make available to you.

Now later on I may go back and look at commit G and decide that I need to split that up. Maybe I put too much into that commit, and some of it isn't quite ready for prime time. So i'll split that commit into G and G'. Because let's say G' is stuff I'm not quite happy with yet.

Well, there is a problem there if you have already incorporated the whole G patch into your code. Of course in that case, all I need to do is produce a new commit J that undoes what I need and send it to you.

We're talking about going back in time and changing commits (amending them, or combining them or splitting them), not changes to code. Hope that makes sense?
 
We're talking about going back in time and changing commits (amending them, or combining them or splitting them), not changes to code. Hope that makes sense?
It kinda does. Thanks. I'll avoid taking this thread any further off-topic by promising to look into git more on my own. If I have any further questions, I'll be sure to start a new thread.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.