views:

61

answers:

5

This has happened quite a few times.

Application working fine. Then I chose a wrong delegate for a view Application did not work (expected) So I chose the right delegate for the view Application still not work / load (should have worked though) Quiting Xcode and returning still doesn't fix it. Only thing to do is delete the project and recreate it

Anyone faced the same problem, any clues on how to fix it ?

+1  A: 

What I can possibly guess is that your app in iphone simulator store some state (for example: archiving) and then everytime you try to load the app again, it tries to used the saved state. Because the saved state is crashed in some ways, it is usual that your app will always crash, even you upgrade your app with new code

The only way you can try is to delete your app from simulator and reinstall it

vodkhang
That seems possible, anyway I can fix this . To be very precise, I delegated my UINavigationItem to "File's Owner" (thats when the app crashed)
Prakash Raman
I tried deleting the app from the simulator and then I "CMD+ENTER" to run to application. That did not help either. So weird.
Prakash Raman
wth?How about delete the nib file and then create the new nib file? How about delete the .m, .h and .xib as well?
vodkhang
A: 

Just to continue what Vodkhang saying is the case.. then do the Clean/Clean all Targets from the Build menu. or delete the application NOT project..

KiranThorat
I tried that, I deleted the ".app" file and then "Clean All Targets", still no hope. I have put a printf in the beginning of "applicationDidFinishLaunching". It does not get printed.To be very clear precise,I delegated my UINavigationItem to "File's Owner" (thats when the app crashed)
Prakash Raman
A: 

Sometimes it's worth uninstalling the app from the simulator (In the simulator, click-and-hold and tap the "X").

tc.
:( no, that did not seem to help either.
Prakash Raman
+1  A: 

Seems likely you've broken the nib file in some way. If it's not too complex, I'd suggest creating a fresh nib and setting your delegate again.

Echelon
I deleted my Navigation Controller, because the nib file is the MainWindow.nib. If I delete my MainWindow.nib can I reconstruct it properly ?
Prakash Raman
The best way would be to create a new empty project, copy the MainWindow.xib to your existing project, and fix up the outlets and references. Bit of a hassle, but it guarantees your nib is good.
Echelon
I copied a new MainWindow.xib, but it did not help. The funny thing is the applicationDidFinishLaunching is not even being called.
Prakash Raman
You need to make sure your File's Owner and App Delegate are set up correctly in IB. App Delegate should be your App Delegate class, and File's owner should connect to the App Delegate object.
Echelon
A: 

I figured out what was wrong.

When I assigned Files Owner as the delegate to UINavigationItem the "AppDeleagate" stopped pointing to the Files Owner. When I reset the AppDeledate delegate to be Files Owner, it worked fine.

This link helped me figure it out. http://forums.macrumors.com/showthread.php?t=377383

Thank you all, for your help :)

Prakash Raman
Be sure to mark the correct answer and upvote the helpful stuff. That should improve your 0% accept rate.
Echelon