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 634885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:20:40+00:00 2026-05-13T20:20:40+00:00

I am having a baffling issue while trying to fill an NSMutableArray with UIImages.

  • 0

I am having a baffling issue while trying to fill an NSMutableArray with UIImages.

CGBitmapInfo bitmapInfo = kCGBitmapByteOrderMask;
CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

while(...)     // <--- Iterates through data sets
{

          CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, data, numBytes, NULL);
          CGImageRef cImage = CGImageCreate(iw, ih, 8, 32, 4 * iw, colorSpace, bitmapInfo, provider, NULL, NO, renderingIntent);
          UIImage *finalImage = [UIImage imageWithCGImage:cImage];


          [images addObject:finalImage]; // <--- Declared and instantiated earlier

          [delegate sendImage:finalImage];

          CGImageRelease(cImage);
          CGDataProviderRelease(provider);
}

CGColorSpaceRelease(colorSpace);

[delegate operationCompletedWithImages:images];

That is how I have the code running. So I basically have a function running in the while statement that returns the next set of bitmap data, I then create a UIImage and store it into the mutable array.

I’ve tested this by writing each file to disk and then accessing them which results in the proper set of images. The problem is when using the array to keep data in memory, accessing any image object in the array I get the same exact image over and over. The image is also always the last image of the set.

I’ve tried testing the contents by setting the array as a UIImageView animation array and by using an NSTimer to cycle the contents. Either way it is just the same image (last image pulled) over and over.

I have this operation running inside a subclassed NSOperation object so it doesn’t block the interface. Another interesting aspect here is that when the images array sent with operationCompletedWithImages was giving me the array of duplicate images I tried using the sendImage message and store the images in a different array inside the delegate object (thinking maybe it was a threading issue). This gave me the same results.

I’ve been stuck on this for over a week with no progress. I’ve never seen anything like it and I can’t find anyone else who has had a similar issue.I would be happy to provide extra information if someone feels it would assist in solving this issue.

If anyone could provide any assistance I would greatly appreciate 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-13T20:20:40+00:00Added an answer on May 13, 2026 at 8:20 pm

    Figured out the problem. Turned out to be an issue with the backing data pointer.

    Where before I was accessing data everytime thinking it would iterate and overwrite with new contents, and the new contents would be plugged into my CGDataProviderRef. This was not the case, I basically ended up supplying a pointer to the same backing data for the Provider. The solution was to copy the data into an NSData object and use that copy for the DataProvider.

    So instead of:

    CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, data, numBytes, NULL);
    

    It would be:

    NSData *pxData = [[NSData alloc] initWithBytes:pFrameRGB->data length:numBytes];
    CGDataProviderRef provider = CGDataProviderCreateWithCFData((CFDataRef)pxData);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 371k
  • Answers 371k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer These are the relevant JLS sections: JLS 5.1.1 Identity Conversion… May 14, 2026 at 7:07 pm
  • Editorial Team
    Editorial Team added an answer demo: http://so.lucafilosofi.com/save-all-css-properties-of-element-using-jquery i have updated the answer to be more… May 14, 2026 at 7:07 pm
  • Editorial Team
    Editorial Team added an answer It seems that Facebook are having problems due to a… May 14, 2026 at 7:07 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.