why would I sometimes lose Navigation items when clicking to return to previous screen in UINavigationController app? - iphone

Anyone know why would I sometimes lose Navigation items when clicking to return to previous screen in UINavigationController app?
Background:
have a iPhone app using a UINavigationController and UITableViews
98% of the time things are fine, and if I'm on the detailed screen and click the "back" button things are find. The app takes you back to the main screen (pop's a view off the stack)
a small percentage of the time, and on the iPhone device itself, I click to go back, see some animation start, but I end up (a) on the same page, and (b) no navigation buttons or toolbar buttons appearing
from this state you can't do anything obviously and have to kill the app and re-start
Any ideas? How to fault find? (noting it's only occasionally when testing on an actual device I notice, and it may take hours/days before it does occur)
thanks

Add an alert in didReceiveMemoryWarning function of the viewController. The OS calls viewDidUnload on some memory warning (which don't usually happen in simulator).

Related

Memory not released when storyboard disappear

In my app there is a Login.storyboard and Dashboard.storyboard. Once I tap login button I am presenting Dashboard. When I tap logout button, all I do is perform unwind segue to Login. My DashBoard.storyboard disappear, but my memory allocations still are the same. When I login again, I allocate a new objects, when I logout, nothing changes. Doing just two things (login (present storyboard), logout (unwind)) I only increase allocations, instead of decreasing it while logging out.
How to fix this? Is it normal?
In my app there is a Login.storyboard and Dashboard.storyboard.
If literally true, that's your problem. You don't need two storyboards here - just one storyboard with two view controllers (scenes). If you're going to use two storyboards, then you just have to live with the extra memory usage that this entails.

UINavigationItem out of sync when using popToRootViewController

I tap a tab bar item, which triggers poptoRootViewControllerAnimated. Most of the time it works as expected, but in some cases it pops to the correct view, but the navigation item is out of sync, "stuck" from the view i previously was at.
I've read about people having this problem with iPad's, when in landscape mode, but the solutions I've found don't work in this case. This is an iPhone app in portrait mode.
Happens with the simulator as well as on an actual iPhone. If someone has a suggestion or solution i'll be a very happy man!
Turns out that the different iOS versions handle this differently. This only occured on the older versions, so we had to rebuild the stack manually there.
do you get any message in the console like
nested push animation can result in
corrupted navigation bar
and
Finishing up a navigation transition
in an unexpected state. Navigation Bar
subview tree might get corrupted.
if yes take a look at these few answers...
but what they all basically mean is you are trying to pop from the navigation controller too early, probably before it is properly loaded...

UITabBarController Initial View?

I'm wondering if it is possible to start my app with all my tabs in the "up" state and show a "landing" view to the user. Kind of like a welcome/quick start. When they select one of the tabs, it switches views as normal.
Will you point me in the right direction?
Kind of like this:
If you're using a UITabBar/UITabBarController, I think you must have the selectedIndex set to some legal value. I don't think this is possible, nor can I find an app on my iPhone or iPod that mimics the behaviour you're looking for.
(The App Store app is as close as it gets, where it looks like it has an empty tab bar before it loads data from the Internet, but it could very well be that they are just re-using the Default.png and superimposing an activity indicator during loading.)
Note that if you tried to submit your app to Apple, they could easily reject it for using non-standard UI.
The way I would probably do this is to create a new ViewController that's just for this screen, but make sure it's last in the viewControllers array managed by the UITabBarController. That way, when you show the tab bar on the screen, you get the 4 tabs and the more button, but the currently selected view controller is not in the bar, meaning that all of the other tabs are unselected.
Once the user has satisfied the condition for showing the screen, you can discretely remove the view controller from the tab bar, and the user will never be the wiser.

UITabBar ignoring occasional "clicks"

I'm working on an iPhone app that has a UITabBar. Occasionally the tab bar ignores my "clicks" (or "taps", or whatever they're called in the iPhone world). It happens on both the simulator and the on the device. Clicking on a tab bar button won't result in any action, and I have to click it several times for the expected action to occur.
Can anybody shed any light on what might be causing this issue, or how I can go about debugging it?
I read somewhere that the UITabBar becomes unresponsive when it is not the immediate child of the window. It can be something like that or you might have a UIScrollView or some other view interfering with your UITabBar.
P.S
Click is correct for buttons, including tabs. For others, a widely used term is touch.
This might be happening bcoz the view is not getting loaded when you click on the tab.
Are you using any url request in the -(void)viewDidLoad method. If this is the case may be ur internet is workin slowly.

Buggy navigation controllers, porting iPhone app to the iPad

I have a fairly simple iPhone application that I want to have run on both the iPhone and the iPad. I'd like to just have the iPad version be a bigger version of the iPhone version, scaled up or not -- I'm working on an iPad-specific version of the app that makes better use of the interface, but wanted to make sure my existing customers have something in the meantime.
The app is a simple tab-based application, and within each tab is a navigation controller that presents a table view, each of which can drill down a couple of layers. Everything mostly works -- I have a couple of instances of views not filling the space available, but I can fix that. My biggest problem right now is that the navigation controllers universally break when I try using them. Once I drill down a level or two, I suddenly won't be able to come back up again.
Let me try to explain in more detail:
One tab starts off with a "year" table view, showing all years that have entries; if you tap a year, it pushes another table view with all months in that year that have entries; if you tap a month, it pushes another table view that shows the individual entries; if you tap an entry, it pushes a view (a UIWebView, with some extra widgets) that shows an entry's details.
Each push is done with [self.navigationController pushViewController: foo animated: YES]. The three table view controllers I mentioned above are all created from the same nib (in fact, everything pushed onto a navigation controller in any tab is loaded from the same nib). Since I know there are only up to three levels of navigation, I just allocated three identical view controllers and use one, two, or three depending on how many entries there are.
Popping these controllers off using the "back" button seems to universally mess up the state of the view controller. So, if I drill down to the third view -- showing everything in a single month -- I won't be able to pop all the way back up to the first view: the back button stops working if I pop up one level.
Another example in another tab: it's one table view that you can tap any entry on, and a new view controller will be pushed that shows the details of that entry. If I tap an entry, tap the back button, then tap the entry again, no back button appears, or sometimes, the text that would go inside the back button appears, but no button appears!
This behavior happens if I try running the iPhone app in scaled mode (built with base SDK 4.0, supporting OS 3.2) or in native mode (built with base SDK 3.2). It runs without problems on the iPhone. I'm kind of at a loss here, because this stuff always "just worked" out of the box, mostly from the defaults that were set up back when I first created the project.
My programmer's instincts are telling me that I'm doing something very wrong in my view navigation, and that the iPad is just exposing it, but I can't figure out what it is.
Has anyone run into an issue like this, or suggest something it might be or some better way to debug what's going on?
The issue was that I had a category on NSMutableArray, which added stack-like methods push and pop. Removing this category class fixed this issue.
WTF, though.