Never thought I'd get an error in this file when I compiled, but after running my app in debug mode, The app stops and highlights the line
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
开发者_如何学Go
in my main.m file as a breakpoint. When I run in normal mode, the app just shows a black screen. What does this mean?
(Update)
Okay, nothing has worked so far. Here is the code that is failing:
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
The stack says
Pending breakpoint 1 - ""main.m":31" resolved
The weird thing is, I removed the aforementioned view controller that preceded this problem, there are still no warning or errors and I the application still either halts in debug mode or returns a black screen and freezes in normal running mode.
Here is a drop containing two screenshots of my view and window arrangements in my two NIBs in IB. You can also download my full project to browse the code, if you wish. The project is named "iHouse.zip"
http://drop.io/6lhubkb
Otherwise, any other specific code anyone would like to see, I'm happy to paste it here on request. Otherwise, I'm stumped.
Thanks.
Solved....sort of. The "31" in the stack was oddly referring to a random line in the commented out apple disclaimer in the beginning of main.m. I removed this and that problem went away. Still not sure why it suddenly became a problem in the first place.
I compared the code side-by-side with another app and found that I had commented out a critical part of applicationDidFinishLoading in the AppDelegate as @IWasRobbed had suggested.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
[window addSubview:splitViewController.view];
[window makeKeyAndVisible];
}
else
{
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
}
Because I was not ready to make this app universal, I commented this part out. In doing so, I took out the crucial piece to tell the app what the heck to load in the first place
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
Thanks everyone for your help. Took all day to find a silly error on my part, but you live and you learn I guess.
It means you probably forgot to hook up a window or view to load after the application launches. Unless you modified the main.m
file (which you shouldn't need to), it should be just fine.
精彩评论