I have a problem with constraints. First of all i want to highlight that this is working on my iPhone 5, but not on iPhone 4.
App crashes on start. This is an error:
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:0x16da56d0 V:[UIImageView:0x16da55f0(55)]>",
"<NSLayoutConstraint:0x16da63f0 V:[UIImageView:0x16da55f0]-(18)-[UIImageView:0x16da5860]>",
"<NSLayoutConstraint:0x16da6450 V:[UIImageView:0x16da5860]-(8)-| (Names: '|':UITableViewCellContentView:0x16da5000 )>",
"<NSLayoutConstraint:0x16da6570 V:|-(15)-[UIImageView:0x16da55f0] (Names: '|':UITableViewCellContentView:0x16da5000 )>",
"<NSAutoresizingMaskLayoutConstraint:0x16db2040 h=--& v=--& V:[UITableViewCellContentView:0x16da5000(44)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x16da56d0 V:[UIImageView:0x16da55f0(55)]>
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.
Clearly problem with my UI elements -> constraints, but now the funniest part. This is the last executed line of code:
player = [[AVAudioPlayer alloc]
initWithContentsOfURL:[NSURL fileURLWithPath:resPath]
error:&error];
How this is connected to UI constraints... That is the question...
Obviously I tried to remove all of my constraints in my ViewController, but it changes nothing.
Could somebody explain it to me?
EDIT:
My elements in ViewController looks like this:
EDIT 2:
ListAdapter:
- (UITableViewCell *)getCell:(UITableView *)tableView
withIndexPath:(NSInteger)index {
_tableView = tableView;
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
id<ISong> song = [_data objectAtIndex:index];
UIImageView *recipeImageView = (UIImageView *)[cell viewWithTag:1];
UIImageView *lockImageView = (UIImageView *)[cell viewWithTag:3];
recipeImageView.image = [UIImage imageNamed:[song boxId]];
UILabel *recipeNameLabel = (UILabel *)[cell viewWithTag:2];
recipeNameLabel.text = [song songName];
if (![Settings isPremium]) {
lockImageView.hidden = [song unlock];
} else {
lockImageView.hidden = YES;
}
[Config setPlayerControllerStyle:recipeImageView main:nil];
cell.translatesAutoresizingMaskIntoConstraints = NO;
return cell;
}