Upgrade to iPhone 3.0 sdk and now simulator shows

2020-03-24 03:50发布

I have an iPhone app that uses an UITabBarController, which contains two UINavigationControllers, each of which in turn contains one or more TableViewControllers (actually, customized UIViewControllers implementing UITableViewDelegate and UITableViewDataSource. ) On launch, it displays the UITabBarController with one of the tableviews displayed. Everything is coded; Interface Builder was NOT used to make any of the UI stuff. It was written in SDK 2. It worked fine in sdk 2.

I recently updated to SDK 3.0. In Info, I set the Base SDK setting to iPhone Simulator 3.0. Now, when I launch the application in Simulator, I see only a blank white screen with the status bar at the top. No signs of my app. However, when I exit the app, the missing tableview displays briefly as the exiting animation is playing. Also, on the blank white screen I can still click where the navigation buttons should be and find that, when I exit the app and the missing screen briefly displays, that navigation has taken me to another screen. So the buttons work, and presumably the tableviewcells are there, they just cannot be seen.

Has anyone seen anything like this? Does anyone have any idea what is causing it and how I can fix it? I noticed that sample apps, such as SQLiteBooks, seem to work fine when updating to SDK 3.0. My app isn't very much different from SQLiteBooks in terms of technologies used, except that, as I said above, I do not use Interface Builder.

8条回答
相关推荐>>
2楼-- · 2020-03-24 04:23

I had the same problem of getting white screen on iphone simulator after upgrading my iOS to 4.2

After trying all the above solutions given by the people in this thread and nothing effecting the problem,

I tried modifying the following code in the

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

method.... by writing this code...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  



    // HomeScreen is my first view that should be displayed on the app launch
    // Creating the homescreen instance in the appdelegate method and 
    // assigned it to the homeScreenWindow element declared in the appdelegate class

    HomeScreen *aHomeScreen = [[HomeScreen alloc]initWithNibName:@"HomeScreen" bundle:nil];
    self.homeScreenWindow = aHomeScreen;
    [aHomeScreen release];
    // assigning ends here

    [window addSubview:[homeScreenWindow view]];
    [window makeKeyAndVisible];

    return YES;
}
查看更多
戒情不戒烟
3楼-- · 2020-03-24 04:34

It appears you have to save the new interface before running. I have never developed for IPhone before and finally figured out why i was getting a white screen. Seems like it should save automatically before running but apparently it doesn't.

查看更多
▲ chillily
4楼-- · 2020-03-24 04:36

In IB, click "Window" and make sure "Visible At Launch" is checked. Mine wasn't and my app finally appeared after checking that box.

查看更多
劫难
5楼-- · 2020-03-24 04:37

I also have this issue, I coud solved doing the following:

In Interface builder:

  • File's owner: is your application delegate
  • window: is the application's delegate window outlet

In XCode: - If you are using 3.0 or upper, comment this code line in your application delegate:

// window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]

查看更多
放我归山
6楼-- · 2020-03-24 04:40

If you're building your window purely in code, be sure to remove the MainWindow.xib from the properties in your target.

If that's not the problem, I have had similar issues before with apps behaving strangely on launch. I'm not sure what the root cause, so it's trial and error for me:

1) Try deleting the build directory and rebuilding.

2) Set the base SDK to iPhone Device 3.0. (The base SDK is overwritten when you build for the simulator anyway)

3) I also had an issue one time where the project plist file and MainWindow.xib got deleted from my project accidentally, and it caused this identical issue. Double check to make sure they are in your project structure if you are using MainWindow.xib.

查看更多
疯言疯语
7楼-- · 2020-03-24 04:43

Yes, I finally found the simple fix - open Window in MainWindow.xib, change the Alpha value to 0 (default is 100).

查看更多
登录 后发表回答