I’m fetching a tweet with ID from TwitterKit, and passing it to a
TWTRTweetTableViewCell cell with the configure method. But sometimes, the profile images get squished, and there’s no tweet text!!! I’m using TwitterKit 2.4.0. I attached a screen shot to show. Anyone else have this problem?
Here is my heightForRow method:
return TWTRTweetTableViewCell.height(for: tweet, style: TWTRTweetViewStyle.compact, width: self.tableView.bounds.width, showingActions: false)
It looks like the error is deep within Twitter’s code and is beyond my control. Especially since I’m passing a tweet in directly from TwitterKit, and using their height method.
Here is the autolayout error given in the xcode console:
[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
(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:0x61800048c260 H:|-(15)-[TWTRProfileHeaderView:0x7f99ba7a3d30] (active, names: '|':TWTRTweetView:0x7f99ba79fee0 )>",
"<NSLayoutConstraint:0x61800048c3a0 H:[TWTRTweetMediaView:0x7f99ba7a0600]-(12)-| (active, names: '|':TWTRTweetView:0x7f99ba79fee0 )>",
"<NSLayoutConstraint:0x61800048c3f0 UILabel:0x7f99bb29b580'Sopan Deb'.leading == TWTRTweetLabel:0x7f99bb29bcb0'Exchange is pretty tellin...'.leading (active)>",
"<NSLayoutConstraint:0x61800048c4e0 TWTRTweetLabel:0x7f99bb29bcb0'Exchange is pretty tellin...'.leading == TWTRTweetMediaView:0x7f99ba7a0600.leading (active)>",
"<NSLayoutConstraint:0x60000048a550 H:|-(0)-[TWTRProfileView:0x7f99ba7a42d0] (active, names: '|':TWTRProfileHeaderView:0x7f99ba7a3d30 )>",
"<NSLayoutConstraint:0x60000048a5a0 H:[TWTRProfileView:0x7f99ba7a42d0]-(9)-[UILabel:0x7f99bb29b580'Sopan Deb'] (active)>",
"<NSLayoutConstraint:0x610000493290 TWTRProfileView:0x7f99ba7a42d0.width == 36 (active)>",
"<NSLayoutConstraint:0x61800048c990 H:|-(0)-[TWTRTweetView:0x7f99ba79fee0] (active, names: '|':UITableViewCellContentView:0x7f99ba79c410 )>",
"<NSLayoutConstraint:0x61800048c9e0 TWTRTweetView:0x7f99ba79fee0.trailing == UITableViewCellContentView:0x7f99ba79c410.trailing (active)>",
"<NSLayoutConstraint:0x60800048f0a0 TWTRTweetMediaView:0x7f99ba7a0600.width == 0 (active)>",
"<NSLayoutConstraint:0x6100004936a0 'UIView-Encapsulated-Layout-Width' UITableViewCellContentView:0x7f99ba79c410.width == 414 (active)>"
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x610000493290 TWTRProfileView:0x7f99ba7a42d0.width == 36 (active)>
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.
2016-09-25 15:50:52.907022 Sifftr[14016:344581] [LayoutConstraints] Unable to simultaneously satisfy constraints.
What I think is happening: It looks like the
configure(with: tweet) method and the
TWTRTweetTableViewCell.height method don’t take into account any images that are in the tweet because they load the image asynchronously. And further, it looks like there is no callback method so that I can adjust the height of the cell to the new height after the image load.