0

My first iOS app got rejected by the App Review team because it crashed on launch. I can't reproduce this crash. The app runs fine on my physical iPad Mini and on all the Xcode simulators. Also, the same build and archive was passed through TestFlight Internal Testing. I have so far not been able to symbolicate the crash logs they sent me. However, I did find this in the syslog:

Aug  7 17:04:44 Michaels-MacBook-Pro-3 SpringBoard[1333]: 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. 
(
    "<NSLayoutConstraint:0x7fccfccd0300 UILabel:0x7fccfccc8510' '.leading == SPUISearchTableHeaderView:0x7fccfccc59f0.leadingMargin>",
    "<NSLayoutConstraint:0x7fccfccd0f80 H:[UILabel:0x7fccfccc8510' ']-(NSSpace(8))-[UIButton:0x7fccfcccb710'Show More']>",
    "<NSLayoutConstraint:0x7fccfccd0fd0 SPUISearchTableHeaderView:0x7fccfccc59f0.trailingMargin == UIButton:0x7fccfcccb710'Show More'.trailing>",
    "<NSLayoutConstraint:0x7fccfccc8880 'UIView-Encapsulated-Layout-Width' H:[SPUISearchTableHeaderView:0x7fccfccc59f0(0)]>"
)

Looking at this, it seems to pertain to a table view, a label and a button. My app is based on the standard Master-Detail project. So there is only one table view in it, the master, and there is only one label in that view, which is in the prototype cell. At one point, I experimented with a disclosure button in the prototype cell, and I suspect the Show More on the second to the last line above may be a lingering effect from that.

Searching on SPUISearchTableHeaderView I found this in github. I notice that it does add a couple of constraints. And those constraints actually contain the text moreButton.

So I feel like I may be on the trail of the cause of the crash: I'm thinking it's some constraints being added programmatically, possibly left over from my experiment with the disclosure button. But I'm not at all sure how to proceed from here. There are no explicit constraints on the label (see screen shot below), and I don't think there ever were. Any help will be greatly appreciated! screen shot showing label

Based on Konstantin's suggestion below, I tried to add constraints to the label, but the only ones available are horizontal and vertical centering. Others are grayed out. (See screenshot below.) And when I try to select horizontal centering, the Add Constraints button at the bottom remains grayed out, so I can't add it!

enter image description here

Community
  • 1
  • 1
user1147171
  • 1,213
  • 3
  • 14
  • 22
  • `NSLayoutConstraint:0x7fccfccd0300 UILabel:0x7fccfccc8510' ` What are the UILabel constraints? – Tony Aug 08 '16 at 05:52
  • I'm not sure you are looking in the right place... This warning normally shows when AutoLayout is trying to fix the layout for you. On ambiguous layout. But the app normally will not crush. Do you have the full stack trace? – MCMatan Aug 08 '16 at 06:20

1 Answers1

0

That's because you have width = 0.

UIView-Encapsulated-Layout-Width' H:[SPUISearchTableHeaderView:0x7fccfccc59f0(0)]

It may happen when you miss some constrains for Label, which is left from Show More Button

H:[UILabel:0x7fccfccc8510' ']-(NSSpace(8))-[UIButton:0x7fccfcccb710'Show More']>

Verify that these label has leading constraints.

Konstantin
  • 861
  • 4
  • 12
  • Thanks, but how do I do that? There are no constraints on the label that I can see. – user1147171 Aug 08 '16 at 06:27
  • That's a problem. View tried to calculate it's width which is dependent from label and button constraints, but cannot because you miss one of them. Just add leading and trailing constraints to that label – Konstantin Aug 08 '16 at 06:30
  • That seemed hopeful, but when I try, t the only alignment possibilities are horizontal and vertical centering. (Added this to the end of the question, with screenshot.) – user1147171 Aug 08 '16 at 07:05
  • I don't see UIButton on cell. Problem with constraint located in UIButton with title 'Show More Button' and label (which is located left from it).Could you should it screen shot with button and label ? – Konstantin Aug 08 '16 at 08:06
  • There is no longer any button on the cell. I experimented with putting a disclosure button there but eliminated it. – user1147171 Aug 08 '16 at 09:32
  • Then try clear all constraints in view and create them again, also provide new error stack if crash appear again – Konstantin Aug 08 '16 at 09:44