iOS UIViewController loading, shows up in view debugger, but not on device

moonman239

macrumors 68000
Original poster
Mar 27, 2009
1,524
22
I have a bit of a problem, for which I can't find a solution.

I have a view controller, which we'll call Bob. Bob is launched via a push segue from another view controller. Bob used to appear on the device, but then I changed the "collectionView:cellForItemAtIndexPath:" method and did a rebuild - at some point after that, Bob started appearing only in my view debugger. I've verified that viewWillAppear gets called, but neither viewDidAppear nor collectionView:cellForItemAtIndexPath do. Interestingly, my CPU stat sits at around 100%.

Solution: Pause the app with the debugger to check if the app is in a loop.
 
Last edited:

Mascots

macrumors 68000
Sep 5, 2009
1,607
1,296
Is the entire app locked up when this happens? And is this CPU usage of 100% localized to your phone or are you running it in the simulator?

From what you've said, it sounds like something in your collectionView:cellForItemAtIndexPath: or viewWillAppear: is blocking other processes from continuing, something like maybe an infinite loop?
 

moonman239

macrumors 68000
Original poster
Mar 27, 2009
1,524
22
Is the entire app locked up when this happens? And is this CPU usage of 100% localized to your phone or are you running it in the simulator?

From what you've said, it sounds like something in your collectionView:cellForItemAtIndexPath: or viewWillAppear: is blocking other processes from continuing, something like maybe an infinite loop?
Well, there's nothing in viewWillAppear (I just overrode it to see why my app is acting the way it is). Also, in cellForItemAtIndexPath, there's no loop of any kind prior to the breakpoint.

There's only one thing the user is supposed to do in the view controller prior to Bob, so I have no visible UIControl other than the button that takes the user to Bob. However, the button appears stuck in the "tapped" state.
 

Mascots

macrumors 68000
Sep 5, 2009
1,607
1,296
Well, there's nothing in viewWillAppear (I just overrode it to see why my app is acting the way it is). Also, in cellForItemAtIndexPath, there's no loop of any kind prior to the breakpoint.

There's only one thing the user is supposed to do in the view controller prior to Bob, so I have no visible UIControl other than the button that takes the user to Bob. However, the button appears stuck in the "tapped" state.
What is before your breakpoint in collectionView:cellForItemAtIndexPath:? Seeing that may be helpful.

The only other things I would suggest would be:
1. Breaking and replacing your segues in Storyboard (to catch unwanted or weird ones)
2. Instead of linking a segue from the cell directly, link it between the view controllers and use perfomSegue: in collectionView:cellForItemAtIndexPath: to see if you have the same result.
3. Using instantiateViewControllerWithIdentifier(_: ) to create the view and manually pushing via the navigation controller pointer

At the very least, it may help you find out where the issue is cropping from.
 

moonman239

macrumors 68000
Original poster
Mar 27, 2009
1,524
22
What is before your breakpoint in collectionView:cellForItemAtIndexPath:? Seeing that may be helpful.

The only other things I would suggest would be:
1. Breaking and replacing your segues in Storyboard (to catch unwanted or weird ones)
2. Instead of linking a segue from the cell directly, link it between the view controllers and use perfomSegue: in collectionView:cellForItemAtIndexPath: to see if you have the same result.
3. Using instantiateViewControllerWithIdentifier(_: ) to create the view and manually pushing via the navigation controller pointer

At the very least, it may help you find out where the issue is cropping from.
OK, thanks, but you misunderstood me a little bit. What's triggering the segue is not a cell, but a button. In fact, the view controller causing the segue doesn't have a collection view or table view. Bob is the one with the collection view.
 

Mascots

macrumors 68000
Sep 5, 2009
1,607
1,296
Oh! I did misread, but the same logic applies as far as changing around the method that you are pushing Bob. Does it work switching between segue and using a navigation controller directly? Are you able to push in another, blank, view?

I know this is kind of verbose, but since I don't have access to any code, all I can do is hint towards where the problem may live.
 

moonman239

macrumors 68000
Original poster
Mar 27, 2009
1,524
22
Oh! I did misread, but the same logic applies as far as changing around the method that you are pushing Bob. Does it work switching between segue and using a navigation controller directly? Are you able to push in another, blank, view?

I know this is kind of verbose, but since I don't have access to any code, all I can do is hint towards where the problem may live.
OK, so I pushed the view controller to the navigation controller instead, and still no luck. Could it be the iPad version? This one is 8.2 and I think I'm using 9 SDK.

Edit: I could see if it works on 9.0. If so, I'm just going to forget about iOS 8.
 

moonman239

macrumors 68000
Original poster
Mar 27, 2009
1,524
22
Not a blue bar, but text next to it. Send me a Screen shot of your whole window. Are you on the latest Xcode?
Yes, and what I've posted above is all I see where it appears there "should" be text saying something like "wAny hAny"
 

iphonedude2008

macrumors 65816
Nov 7, 2009
1,134
448
Irvine, CA
Maybe you have an old interface builder document. Try making a new one and creating a random view controller and connecting that one to your view controller code. See if it will load by placing colored views. Then report back. If that fixes it, its an interface builder issue. If not, its a code issue.
 

moonman239

macrumors 68000
Original poster
Mar 27, 2009
1,524
22
Maybe you have an old interface builder document. Try making a new one and creating a random view controller and connecting that one to your view controller code. See if it will load by placing colored views. Then report back. If that fixes it, its an interface builder issue. If not, its a code issue.
So, it looks like it could be Interface Builder. It worked after creating a new storyboard and wiring up some test data (had to do that because the previous VC passes along data Bob needs).
 

moonman239

macrumors 68000
Original poster
Mar 27, 2009
1,524
22
Just to clarify, though, you wanted me to create a storyboard with just Bob and no segues, right?

Edit: Thanks for lending a hand!
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.