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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:15:07+00:00 2026-05-23T15:15:07+00:00

Here is the code im having issues with: if(DriveInfoDict) { NSLog(@%@, DriveInfoDict); //PrevSpeedsDict =

  • 0

Here is the code im having issues with:

if(DriveInfoDict) {
    NSLog(@"%@", DriveInfoDict);
    //PrevSpeedsDict = [DriveInfoDict objectForKey: @"speed"];
    //NSLog(@"Previous Speed Dict:%@", PrevSpeedsDict);
}



DriveInfoDict = [NSDictionary dictionaryWithObjectsAndKeys:
                 [NSNumber numberWithDouble: CurrentLatitude], @"Lat",
                 [NSNumber numberWithDouble: CurrentLongitude], @"Long",
                 [NSNumber numberWithDouble:speedMPH], @"speed",
                 nil];  

Here, I would like to set DriveInfoDict, so that the next time the function runs it will have the previous value. I have stripped the operators to simplify my problem.

The error I am getting is : EXC-BAD-ACCESS

I am new to Obj-C and I do not know how to make this object accessible here. Some code with explanation as to if it goes in the H or M file would be very helpful.

  • 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-23T15:15:07+00:00Added an answer on May 23, 2026 at 3:15 pm

    You need to retain the dictionary or use alloc/init (which returns a retained dictionary. So either:

    DriveInfoDict = [[NSDictionary dictionaryWithObjectsAndKeys:
                     [NSNumber numberWithDouble: CurrentLatitude], @"Lat",
                     [NSNumber numberWithDouble: CurrentLongitude], @"Long",
                     [NSNumber numberWithDouble:speedMPH], @"speed",
                     nil] retain];
    

    or:

    DriveInfoDict = [[NSDictionary alloc] initWithObjectsAndKeys:
                     [NSNumber numberWithDouble: CurrentLatitude], @"Lat",
                     [NSNumber numberWithDouble: CurrentLongitude], @"Long",
                     [NSNumber numberWithDouble:speedMPH], @"speed",
                     nil];
    

    If you replace the content of DriveInfoDict (that is: assign a new dictionary) don’t forget to first release it.

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

Sidebar

Related Questions

I have some code here: http://jsfiddle.net/zkRq2/2/ that I am having issues with. If you
I'm having some issues creating a string using 'initWithFormat'. Here is the code I'm
Having some issues with my dropdown menu. Code here: http://jsfiddle.net/xY2p6/1/ Something simple I'm just
Having this code: using (BinaryWriter writer = new BinaryWriter(File.Open(ProjectPath, FileMode.Create))) { //save something here
What is the problem here? (Besides having redundant code). $.getJSON works as expected. However
I'm having some trouble with the jQuery hover method. Here's the relevant JavaScript code:
i'm having issues with modifying selected text and images in CKEditor-- here is the
I'm having issues here implementing the SimpleModal ( http://www.ericmmartin.com/projects/simplemodal/ ) version of a modal
I'm having issues with some jQuery code I have. Using $.each I am looping
I am having issues the last number in this code is not being sorted.

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.