简体   繁体   中英

UINavigationController sometimes missing back button on iOS5

Since the iOS 5 upgrade, we have had intermittent reports of a missing back button, something that is supplied by the UINavigationController.

This app has been live on the app store > 1 year so it is unlikely this issue is resolved by the advice provided here , here or here .

I have attached a screenshot showing this issue. Unfortunately I have not been able to repro it on the simulator or on my device, but we have had several reports so far from users.

缺少后退按钮

Has anyone else encountered and/or successfully resolved this issue in iOS5?

Thanks!

I believe I have uncovered the cause of this issue in at least one of the cases. When a user in iOS 5 clicked on a notification, this callback would be called:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

This method would push a view onto the UINavigationController, which actually was new behavior we recently introduced. If the application was previously running it would work properly. If the application was not previously running, it would prematurely push a view onto the navigationcontroller prior to everything being initialized.


Separately from this, there was another issue that caused this bug. I was setting the title of the previous view to the empty string @"", not to be confused with nil, and in this case no back button was being drawn. So, be careful not to ever set the title of your view to the empty string or you will not get a back button!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM