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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:29:08+00:00 2026-05-15T06:29:08+00:00

I am grappling with adding an NSData object to a NSMutable array. The code

  • 0

I am grappling with adding an NSData object to a NSMutable array.
The code is executing fine but it is not adding the objects in the array.The code is as follows:

NSData * imageData = UIImageJPEGRepresentation(img, 1.0);

int i=0;

    do{

        if([[tempArray objectAtIndex:i] isEqual:imageData])
        {
            [tempArray removeObjectAtIndex:i];
        }
        else 
        {
            [tempArray addObject:imageData];
            //NSLog(@"ANURAG %@",[tempArray objectAtIndex:0]);
        }
    }while(i<[tempArray count]) ;

The NSLog statement shows the object added is null however the value of imageData is not null.

I have defined the tempArray as a static memeber of the class in which this code is written.

Is it because of the size of the data object as it is the data of an image?

  • 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-15T06:29:09+00:00Added an answer on May 15, 2026 at 6:29 am

    Do you initialize tempArray before this code section? You cannot add objects to an uninitialized array.

    tempArray = [[NSMutableArray alloc] init];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 529k
  • Answers 529k
  • 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 A type is either explicitly named or anonymous. If the… May 16, 2026 at 11:09 pm
  • Editorial Team
    Editorial Team added an answer Here's how you can get one row from each group… May 16, 2026 at 11:09 pm
  • Editorial Team
    Editorial Team added an answer Firstly have you considered using messaging for what you are… May 16, 2026 at 11:09 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

Related Questions

I was reading over http://android-developers.blogspot.com/2009/04/backward-compatibility-for-android.html But I'm really not grasping how to ignore certain
I've been reading the android documentation on reflection, but i'm just not really grasping
Looking at adding some data graphing to a new iPhone app in development (ala
We're trying to show 4 trend graphs and will be adding data to them
Requests to www.domainname.com and domainname.com should display index.html, not index.php as it does now.
I am grappling with a database design issue at the moment, I will present
I've been grappling with the fraught area of escaping user (text) input for web
I'm trying to understand the ControlStyle property in Delphi 2007, but I'm having trouble
I was reading over at the Android development website about using reflections. But I'm
I know that if I get an object, for example an NSArray, with 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.