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

  • Home
  • SEARCH
  • 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 938551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:39:47+00:00 2026-05-15T21:39:47+00:00

The problem is after i press 2 buttons the App crashes and I can’t

  • 0

The problem is after i press 2 buttons the App crashes and I can’t figure out why

Button1 is wired to button1
Button2 is wired to button2
…
Button5 is wired to button5

What am I doing wrong?

Basically I want to check if the sequence of #’s is punched in correctly (55235)

In my AppDelegate.H file, I’ve defined a variable called

NSString* myEasterEgg;

In AppDelegate.M, I have 5 buttons that are correctly wired and each button has it’s own method

-(IBAction)button1:(id)sender
{
if(CFStringCompare((CFStringRef)myEasterEgg, (CFStringRef)@"52235", 1) == 0)
{
myEasterEgg = @"";
} else {
myEasterEgg = [myEasterEgg stringByAppendingString:@"1"];
}
}

-(IBAction)button2:(id)sender
{
if(CFStringCompare((CFStringRef)myEasterEgg, (CFStringRef)@"52235", 1) == 0)
{
myEasterEgg = @"";
} else {
myEasterEgg = [myEasterEgg stringByAppendingString:@"2"];
}
}

-(IBAction)button3:(id)sender
{
if(CFStringCompare((CFStringRef)myEasterEgg, (CFStringRef)@"52235", 1) == 0)
{
myEasterEgg = @"";
} else {
myEasterEgg = [myEasterEgg stringByAppendingString:@"3"];
}
}

-(IBAction)button4:(id)sender
{
if(CFStringCompare((CFStringRef)myEasterEgg, (CFStringRef)@"52235", 1) == 0)
{
myEasterEgg = @"";
} else {
myEasterEgg = [myEasterEgg stringByAppendingString:@"4"];
}
}

-(IBAction)button5:(id)sender
{
if(CFStringCompare((CFStringRef)myEasterEgg, (CFStringRef)@"52235", 1) == 0)
{
myEasterEgg = @"";
} else {
myEasterEgg = [myEasterEgg stringByAppendingString:@"5"];
}
}

-(void)viewDidLoad
{
myEasterEgg = [[NSString alloc] initWithString:@""];
}
  • 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-15T21:39:48+00:00Added an answer on May 15, 2026 at 9:39 pm

    You are leaking your original string, and replacing it with new values without retaining them. The crash happens because you’re calling [myEasterEgg stringByAppendingString:…] on a dangling pointer, that is, a variable which no longer refers to any object. See the Memory Management Programming Guide for more information.

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

Sidebar

Related Questions

Weird problem: After rotating my app to portrait, picking the toolbar item and exposing
I'm trying to create buttons after i press a button ( this one is
I can't figure out what is causing this. Basically, a few different 'tasks' are
I'm hoping someone can find this problem. I had an app that was fully
I have a problem after i setup windows 7 all old projects in c#
I'm now making unit-tests for already existing code. I faced the next problem: After
I have this problem where after a field (say Field3 in table MyTable) is
I have a weird problem where after setting nocheck on a foreign constraint and
I'm having the weird problem that after having javascript inject some dom-elements the css-rules
After having solved the problem of getting the editor to launch when there's 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.