Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7552877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:53:50+00:00 2026-05-30T10:53:50+00:00

I am developing an iOS app using iOS 5. I am having trouble using

  • 0

I am developing an iOS app using iOS 5.

I am having trouble using grand central dispatch to fill a view for a GMGridViewCell.

THe problem is not with the GridCell it self, but with the access to data in GCD.

Here is my code:

- (GMGridViewCell *)GMGridView:(GMGridView *)gridView cellForItemAtIndex:(NSInteger)index
{
    //NSLog(@"Creating view indx %d", index);

    CGSize size = [self sizeForItemsInGMGridView:gridView];

    GMGridViewCell *cell = [gridView dequeueReusableCell];

    if (!cell) 
    {
        cell = [[GMGridViewCell alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
    }

    [[cell.contentView subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];

    dispatch_queue_t fillCellQueue = dispatch_queue_create("Cell fetch queue", NULL);
    dispatch_async(fillCellQueue, ^{
        SearchGridViewCell *cellView = [UIView loadFromNib:@"SearchGridViewCell" owner:self];
        Item *item = [self.foundItems objectAtIndex:index];

        cellView.itemImageView.image = [UIImage imageWithData:item.image.thumb];

        cellView.itemNameLabel.text  = item.name; 

        cellView.brandImageView.image = [UIImage imageWithData:item.group3.image.thumb];

        Attribute *itemAttribute = [item.attributes objectAtIndex:0];
        cellView.attributeLabel.text  = [itemAttribute.name stringByAppendingFormat:@": "];
        [cellView.attributeLabel sizeToFit];

        cellView.itemAttributeValueLabel.text = itemAttribute.value;
        [cellView.itemAttributeValueLabel sizeToFit];

        dispatch_sync(dispatch_get_main_queue(), ^{
            [cell addSubview:cellView];
        });
    });
    dispatch_release(fillCellQueue);

    return cell;
}

When running the app I get the following error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'statement is still active'
*** First throw call stack:
(0x1a1f052 0x35b3d0a 0x11cde0a 0x11cd58d 0x11f689f 0x11ec955 0x11d7df4 0x11f6418 0x11f3b62 0x11f3a57 0x11f316b 0x11f2f97 0x11f2b75 0x11f29f2 0x1236e10 0x51de7 0x44ab445 0x44acecf 0x44acd28 0x44ac4af 0x91442b24 0x914446fe)

What am I doing wrong?

EDIT More info,

The first line that throws the exception:

cellView.itemImageView.image = [UIImage imageWithData:item.image.thumb];

And I believe the problem is from GCD because when I run this without GCD it works fine. But the scrolling of the grid is a bit sluggish, which is why I want to add GCD to it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:53:52+00:00Added an answer on May 30, 2026 at 10:53 am

    I believe the problem is with self.foundItems, which I’m guessing is the result of an NSFetchRequest request in another thread. NSManagedObject cannot be passed between threads. You have to fetch the objects in the same thread you’re going to use it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an iOS app. Its working properly on simulator. I'm using phonegap and
I am developing and iOS app with both positions, Landscape and Portrait. Using iOS5,
I am developing an iOS app using XCode 4.2 I have a UIImage variable
I am developing an iPhone app in iOS 5. I am using UIImagePickerController to
I'm developing an app in IOS using RestKit . Data is retrieved successfully but
I'm developing a iOs 5 app ( View in App Store ) with native
I am developing an iOS app using iOS 4.2 SDK, but I want the
I am developing an IOS app using cocos2d and the SimpleAudioEngine for playing a
I'm developing an iOS app with Twitter features. To do that I'm using SA_OAuthTwitterEngine
I am developing an iOS app that allows users to download documents off a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.