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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:28:40+00:00 2026-05-21T21:28:40+00:00

I am constantly getting the EXC_BAD_ACCESS error in multiple places but always on the

  • 0

I am constantly getting the EXC_BAD_ACCESS error in multiple places but always on the nsuserdefaults below is the places were it keeps erroring.

    //Get results
NSString *currentYes = [[NSUserDefaults standardUserDefaults] stringForKey:@"yes"];
NSString *currentNo = [[NSUserDefaults standardUserDefaults] stringForKey:@"no"];

And again here:

- (IBAction)VoteQ1:(id)sender
{
    //Save question 1 to device
    [[NSUserDefaults standardUserDefaults] setObject:@"Q1" forKey:@"questionnumber"];
    [[NSUserDefaults standardUserDefaults] setObject:[self.Question1 objectAtIndex:0] forKey:@"Question"];
    [[NSUserDefaults standardUserDefaults] setObject:[self.Question1 objectAtIndex:1] forKey:@"yes"];
    [[NSUserDefaults standardUserDefaults] setObject:[self.Question1 objectAtIndex:2]forKey:@"no"];
    [[NSUserDefaults standardUserDefaults] setObject:[self.Question1 objectAtIndex:3] forKey:@"start"];
    [[NSUserDefaults standardUserDefaults] setObject:[self.Question1 objectAtIndex:4] forKey:@"end"];
    [[NSUserDefaults standardUserDefaults] synchronize];


    FlipViewController *controller = [[FlipViewController alloc] initWithNibName:@"FlipView" bundle:nil];
        controller.delegate = self;

        controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentModalViewController:controller animated:YES];

        [controller release];
}

i also have (IBAction)VoteQ2:(id)sender and (IBAction)VoteQ3:(id)sender which are the same as above but self.question1 is like question 2 or 3.

The error comes when i click another ibaction after clicking and completing the flip view.

Please help i believe it is something to do with nsuserdefaults not releasing it self

Thanks

  • 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-21T21:28:41+00:00Added an answer on May 21, 2026 at 9:28 pm

    It might be a casting problem. You are setting an object

    setObject:[self.Question1 objectAtIndex:1]
    

    but fetching it into an NSString:

    stringForKey:@"yes"
    

    Assuming your objects in Question1 array are NSString objects, try this:

    NSString *currentYes = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:@"yes"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.