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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:32:57+00:00 2026-05-24T06:32:57+00:00

in my iOS app’s viewDidLoad method, i have the following line of code: loadDict

  • 0

in my iOS app’s viewDidLoad method, i have the following line of code:

loadDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"1.0", "version number", nil]; 

and it causes an EXC_BAD_ACCESS error. i don’t know why. nothing else in the viewDidLoad method uses the object except the other side of the if/else statement this line is in, so there’s no way it could have been released already. i’m just not sure what the problem is. if you want to see my whole viewDidLoad method, here it is:

- (void)viewDidLoad
{
    [super viewDidLoad];
    tapsBackground = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboard)];
    tapsBackground.delegate = self;
    [self.view addGestureRecognizer:tapsBackground];

    saveChangesButton.hidden = YES;

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    filePath = [documentsDirectory stringByAppendingPathComponent:@"presets.plist"];

    if([[NSFileManager defaultManager] fileExistsAtPath:filePath]){
        loadDict = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
    }

    else{
        loadDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"1.0", "version number", nil];
        [loadDict writeToFile:filePath atomically:YES];
    }
}
  • 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-24T06:32:58+00:00Added an answer on May 24, 2026 at 6:32 am

    The problem is that you are missing @ in the second string i.e. "version number".

    loadDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"1.0", "version number", nil];
    

    It should be,

    loadDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"1.0", @"version number", nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iOS app with the following (selected) build settings in XCode 4.0.1:
I have an iOS app that displays content from a sqlite db in a
I have a universal iOS app with a custom view that has three buttons,
I have 2 applications, one is iOS app and one is .NET app. I
I am new to ios app development, Below is the code I used to
I have a tabbar-based iOS app with two tabs. When I tab into the
When trying to run my iOS app on a device, I get the following
Developing ios app. I have an object class Product.h and .m respectively along with
I have written an iOS app that calls NSUrlConnection multiple times to download image
I have an iOS app that makes phone calls using the Telephone application by

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.