6

I am using the UITableView.

 CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierLink];

This is the line I am getting the error. It is working in IOS 7. But when I run the application in IOS 8 I am getting the error

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

EDIT

Full code

- (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;

}
Puvanarajan
  • 2,786
  • 6
  • 26
  • 37

1 Answers1

2

Check out the answer here: why do i get "Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES" in xcode 6 beta

This solved it for me temporarily.

Community
  • 1
  • 1
kakubei
  • 5,321
  • 4
  • 44
  • 66
  • 10
    To everyone else, make sure that you check **all** the views within your `UITableViewCell` that they aren't set to the class, `UITableViewCell`. I looked outside of the `UITableView` and realized that I named a `UIView` **INSIDE** the `UITableView` (specifically the cell), a `UITableViewCell`. – Nate Lee May 12 '15 at 21:01
  • 1
    ^this comment should be the real answer .. It's possible that the offending subview could be of any improper type (not just `UITableViewCell`), but the overall message is the same. Loop through your subviews, check the classes, and you'll probably find your error there. – Brian Sachetta Mar 07 '16 at 19:15