I'm using Apple's TestFlight beta testing service to test my apps. I have an Xcode build that works fine on my iPhone 6, and other, older devices as well.
When I upload my build to iTunes Connect and turn on beta testing, everything initially works great. Users can launch the app, and perform most actions without the app crashing. However, when users click the "Play Game" button the app inexplicably crashes!
Because the app can be opened with no problem, I'm assuming it has nothing to do with provisioning profiles. On the exact same device, the Xcode build works fine but the TestFlight version crashes when pressing "Play Game".
I'm also assuming this is not a memory issue, as displayed memory in Xcode when a running the app on a device shows it under 10 mb when clicking play game.
I am getting some AutoLayout issues that appear in the debugging console, so could that be the problem?
2015-02-09 17:35:15.611 CYM SA[13111:2396370] 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)
(
"<NSLayoutConstraint:0x1700919e0 H:|-(0)-[UIButton:0x14fe24470'Go To: 1'] (Names: '|':UIView:0x170193180 )>",
"<NSLayoutConstraint:0x170091a30 H:[UITextView:0x150856a00'hello, I'm 0 wow A paragr...']-(8)-| (Names: '|':UIView:0x170193180 )>",
"<NSLayoutConstraint:0x170091ad0 H:|-(8)-[UITextView:0x150856a00'hello, I'm 0 wow A paragr...'] (Names: '|':UIView:0x170193180 )>",
"<NSLayoutConstraint:0x170091b70 H:[UIButton:0x14fe24650'Go To: 2']-(0)-| (Names: '|':UIView:0x170193180 )>",
"<NSLayoutConstraint:0x170091c10 UIButton:0x14fe24650'Go To: 2'.width == UIButton:0x14fe24470'Go To: 1'.width>",
"<NSLayoutConstraint:0x170091c60 H:[UIButton:0x14fe24470'Go To: 1']-(0)-[UIButton:0x14fe24650'Go To: 2']>",
"<NSAutoresizingMaskLayoutConstraint:0x1700938d0 h=--& v=--& UIButton:0x14fe24470'Go To: 1'.midX == - 1850>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x170091c60 H:[UIButton:0x14fe24470'Go To: 1']-(0)-[UIButton:0x14fe24650'Go To: 2']>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
@AdamPro13 adding Crashlytics allowed me to find the issue. For whatever reason ONE initialized variable in ONE for loop caused all this ruckus. It's still really weird that this didn't crash the build loaded from Xcode to my device. The problem occurred when I tried to get a custom object from an array, but the number shown in the exception was something huge like 1844402943409882943843209824390 or something close to that.
This:
for (int i; i<[self.elementsArray count]; i++) {
Element *tempElement = [[Element alloc] init];
tempElement = [self.elementsArray objectAtIndex:i];
}
Should have been this:
for (int i = 0; i<[self.elementsArray count]; i++) {
Element *tempElement = [[Element alloc] init];
tempElement = [self.elementsArray objectAtIndex:i];
}