Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Going back to a tab when it is showing a nested navigation stack causes an auto layout exception #19

Open
rastersize opened this issue May 1, 2013 · 8 comments
Assignees

Comments

@rastersize
Copy link
Contributor

The app crashes halts at a debug exception the second time the “My Profile” tab is shown.

Steps to reproduce

  1. Tap “My Profile” tab.
  2. Tap on any other tab.
  3. Tap “My Profile” tab again.
  4. Crash

The crash

The crash occurs in the -[AKTabBarView setContentView:] method on line 47 due to some contradicting auto layout constraints in the OPFUserProfileViewController.

2013-05-01 16:07:43.868 Code Stream[96082:c07] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x13c54f20 h=--& v=--& H:[UITableViewCell:0xa246ed0(0)]>",
    "<NSLayoutConstraint:0x13c4bac0 UIWebView:0xa26f620.leading == UITableViewCell:0xa246ed0.leading + 10>",
    "<NSLayoutConstraint:0x13c50280 UITableViewCell:0xa246ed0.trailing == UIWebView:0xa26f620.trailing + 10>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x13c50280 UITableViewCell:0xa246ed0.trailing == UIWebView:0xa26f620.trailing + 10>

Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

Possible fixes

  • Investigate if it is AKTabBarController which is incompatible with auto layout and in such case fix AKTabBarController.
  • Change all of our views to use springs and struts instead of auto layout. Most likely a huge task!

/cc @tdeekens

@ghost ghost assigned tdeekens and makxan May 1, 2013
@tdeekens
Copy link
Member

tdeekens commented May 1, 2013

I know, i knew your'd see it.
The my profile view is @makxan view.

@makxan
Copy link
Contributor

makxan commented May 1, 2013

It seems like there is a problem with the constraints that belongs to the UIWebview. At the moment I don't know why the error shows up the second time and not the first time when clicking on "My Profile", but we can look at the problem tomorrow.

@makxan
Copy link
Contributor

makxan commented May 1, 2013

The same problem appears when viewing a question a second time.

Steps to reproduce

  1. Go to a question in the Questions-view
  2. Click on another tab
  3. Click on the Questions-tab again
  4. Crash.

@rastersize
Copy link
Contributor Author

That’s in the OPFQuestionHeaderView. A possible fix could be to disable automatic translation of auto resizing masks with
(e.i. theView.translatesAutoresizingMaskIntoConstraints = NO). Might introduce other issues though if there are views which do not have any auto layout constraints.

On May 1, 2013, at 16:50, Marcus Johansson [email protected] wrote:

The same problem appears when viewing a question a second time.

Steps to reproduce

Go to a question in the Questions-view
Click on another tab
Click on the Questions-tab again
Crash.

Reply to this email directly or view it on GitHub.

@makxan makxan closed this as completed May 17, 2013
@rastersize
Copy link
Contributor Author

This issue isn’t resolved as far as I know? Still occurs in master for me (exact same steps to reproduce as previously).
@makxan

@rastersize rastersize reopened this May 17, 2013
@makxan
Copy link
Contributor

makxan commented May 17, 2013

Well, on my computer no crash or error message was produced so that's why I thought it had been resolved :/

@rastersize
Copy link
Contributor Author

One way to solve this issue, as it seems to be caused by AKTabBarController being incompatible with auto layout, is to make AKTabBarController behave when used with auto layout. Another way would be to change all our views to use springs and struts instead.

@makxan
Copy link
Contributor

makxan commented May 21, 2013

Right now I feel that we shouldn't change so much in the app since we will present it on thursday. The app is still working when the crash occurs and as long as we don't show them the console when we run the app we should be fine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants