Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
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:
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?
 
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.
 
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.
 
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.
 
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.
 
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.
 
I don't know.
In interface builder (the storyboard editor), look at the bottom bar just above the debugger. In the middle of it, it should have two values. Tell me the two values that show up.
Screen Shot 2015-10-29 at 10.50.52 AM.png
 
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.
 
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).
 
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.