UITableview Cellexception – '必须将自动resize的掩码转换为约束才能拥有_setHostsLayoutEngine:YES

我正在使用UITableView。

CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierLink]; 

这是我得到错误的线。 它在IOS 7中工作。但是当我在IOS 8中运行应用程序时,我收到错误

 ** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES. 

编辑

完整的代码

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifierImageLink = @"NewsImageAndLink"; static NSString *CellIdentifierImage = @"NewsImage"; static NSString *CellIdentifierLink = @"NewsLink"; static NSString *CellIdentifier = @"NewsDescription"; NSString *image=[[_news objectAtIndex:indexPath.row] valueForKey:@"imageURL"]; NSString *link=[[_news objectAtIndex:indexPath.row] valueForKey:@"link"]; NSString *description=[[_news objectAtIndex:indexPath.row] valueForKey:@"description"]; NSString *date=[[_news objectAtIndex:indexPath.row] valueForKey:@"date"]; NSString *title=[[_news objectAtIndex:indexPath.row] valueForKey:@"title"]; NSMutableString *html = [NSMutableString stringWithString: @""]; //continue building the string [html appendString:@"<html><body>"]; [html appendString:description]; [html appendString:@"</body></html>"]; SDWebImageManager *manager = [SDWebImageManager sharedManager]; if (image !=(NSString *)[NSNull null] && link !=(NSString *)[NSNull null]) { CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierImageLink]; cell.lblHeading.text=title; NSURL *url = [NSURL URLWithString:image]; [manager downloadImageWithURL:url options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) { } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { cell.newsImage.image = image; }]; if (date !=(NSString *)[NSNull null] ) { cell.lblDate.text=date; } //pass the string to the webview [cell.webView loadHTMLString:[html description] baseURL:nil]; cell.lblLink.text=link; return cell; } else if (image !=(NSString *)[NSNull null] && link==(NSString *)[NSNull null]) { CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierImage]; cell.lblHeading.text=title; NSURL *url = [NSURL URLWithString:image]; [manager downloadImageWithURL:url options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) { } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { cell.newsImage.image = image; }]; if (date !=(NSString *)[NSNull null] ) { cell.lblDate.text=date; } [cell.webView loadHTMLString:[html description] baseURL:nil]; return cell; } else if (image ==(NSString *)[NSNull null] && link!=(NSString *)[NSNull null]) { CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierLink]; cell.lblHeading.text=title; if (date !=(NSString *)[NSNull null] ) { cell.lblDate.text=date; } //cell.txtDescription.text=description; //pass the string to the webview [cell.webView loadHTMLString:[html description] baseURL:nil]; cell.lblLink.text=link; return cell; } else if (image ==(NSString *)[NSNull null] && link==(NSString *)[NSNull null]) { CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; cell.lblHeading.text=title; if (date !=(NSString *)[NSNull null] ) { cell.lblDate.text=date; } //cell.txtDescription.text=description; //pass the string to the webview [cell.webView loadHTMLString:[html description] baseURL:nil]; return cell; } return nil; } 

看看这里的答案: 为什么我得到“必须翻译自动resize的面具约束有_setHostsLayoutEngine:YES”在Xcode 6testing版

这为我暂时解决了。

我见过这种情况发生在约束之下。 尝试运行删除了约束的代码,并逐个重新添加它们。