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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:30:57+00:00 2026-06-07T05:30:57+00:00

I am currently working on my first app for the iPhone, I am almost

  • 0

I am currently working on my first app for the iPhone, I am almost done and but I am having a problem with memory management and such. Keep in mind I am pretty good with java and I only have been learning Objective C for about 4 days.

So, the exact problem lies in this area (Between the lines of asterisks’).
Note: All of the code lies inside a big game loop if that matters.

else 
        {
            ***********************************
            NSString *rand = [NSString stringWithFormat:@"%@", randNumberS];
            while(lastTime + interval >= currentTime)
            {
        !!!!!!!!!NSString *user = [NSString stringWithFormat:@"%@", userText]; 
                    if([user isEqualToString: rand])
                    {
            ***********************************
                        score += 10;
                        randNumberS = nil;
                        timeToGenerateNum = true;
                        bottomClear = true;
                        break;
                    }
                    else 
                    {

                        //NSLog(@"%@ != %@, %i", userText, randNumberS, score);
                    }

            }
            NSLog(@"Game Over! Your score was %i!", score);
        }
    }

Every time I ran before I enabled zombies (Note: The code ran for a few seconds btw), I got a Thread 6: Program received signal: "EXC_BAD_ACCESS" at the line marked with the “!”. After I enabled zombies, it runs for a few seconds and then it stops working and the message -[CFString respondsToSelector:]: message sent to deallocated instance 0x11168440 appears in the console. It also flags the same line with the “!”

I looked both of these up and they both point to poor memory management, I have tried releasing the NSString objects but my program won’t let me release the objects (Note: I get this error message "release" is unavailable: not available in automatic reference counting mode).

Any help would be greatly appreciated, thanks!

EDIT:

userText is used in a various number of methods, but mostly in this one.

-(IBAction)button1Clicked:(id)sender
{    
if(userText == nil)
{
    userText = [NSString stringWithFormat:@"%i", 1];
}
else 
{
    userText = [NSString stringWithFormat:@"%@%i",userText , 1];
}
bottomLabel.text = userText;
NSLog(@"Test 1");
}
  • 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-07T05:30:58+00:00Added an answer on June 7, 2026 at 5:30 am

    The userText variable is not a valid object, which is what your error messages indicate. In general, EXC_BAD_ACCESS happens when you try to use a pointer which points to something that is no longer around. Then with Zombies enabled, the message is even more clear, userText used to be a string, but has been deallocated.

    EDIT:

    If userText is an instance variable, it is recommended to use properties and then the dot notation. Somewhere there is an @interface section where userText is declared. It should look like this:

    @property (nonatomic, strong) NSString *userText;
    

    Then in an @implementaiton area, something like this:

    @synthesize userText = _userText;
    

    These, together, make dot-notation available, and then you should use self.userText to access it everywhere (except custom accessors):

    self.userText = @"something";
    NSString *something = self.userText;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a beginner in WPF and currently working on my first app. For this
I'm currently working on my first Django app, which allows registered users to submit
I'm currently working on a Java Application and it's my first Java App. So
I'm currently working on an app that works with Twitter, but while developing/testing (especially
I'm new to iPhone development and now working on my first app. I have
At first I thought this was a problem with my app, but it seems
I'm new to Objective C and XCode, currently working on my first iPhone Game.
I am currently working on my first android app. In a listview, I need
Currently working for the first time with JSON and with little experience of jQuery.
I'm currently working on my first deployment of a large server side application which

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.