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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:14:56+00:00 2026-06-04T17:14:56+00:00

in the .h file: double var1; NSString *Items[90]; in the .m file: var1 =

  • 0

in the .h file:

double var1;
NSString *Items[90];

in the .m file:

var1 = 1000;
NSString  *j = [NSString stringWithFormat:@"%g", var1 ];
Items[42] = [@" Per each " stringByAppendingString: j ];

see code above, the issue is that thru the app running i have a proc that needs this
Items[42] value however the value is not there anymore ( i didn’t erase it ) but
the cell is completely empty no null or spaces, as if the cell value was released.

on the other hand if i just place in Items[42] some string with no attached variable (like var1) (i.e. Items[42] = @”hello there”; )
then all is ok and the value of Items[42] is being preserved.

any idea why the cell when presented with a variable content (like var1 ) the cell lose content?

TIA

  • 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-06-04T17:14:57+00:00Added an answer on June 4, 2026 at 5:14 pm

    The reference counter of temporary string is zero. It would be destroyed at any time. There are three options to solve the problem:

    1. Items[42] = [[@" Per each " stringByAppendingString: var1 ] retain];
      In non-ARC env, and remember to call [Items[42] release] later.
    2. Declare Items as NSMutableArray* or NSArray*, i.e. NSMutableArray*
      Items. Which will automatically manage the reference count of its
      objects
    3. Convert the program to use ARC

    For global (static) constant strings, they have an infinite reference counter, and would never be destroyed.

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

Sidebar

Related Questions

I've double checked all the connections in the nib file. My code - //
I have a text file that have strings enclosed within double-quotes. I want to
I have a file containing a [Double] serialized by Data.Binary that I'd like to
I declared a constant in a header file const double EARTH_RADIUS=6353; that is imported
I have a string that contains source code of an other groovy file in
I want to get the rules of a css file that are double or
I have a file with a double-linked-list that contains a set of process identifiers
Is there something in a BATCH file that would double a % character? The
Can I include the rt.jar in my executable jar file and double click to
this is a small program using Java Scanner which reads a file of double

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.