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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:01:42+00:00 2026-05-30T21:01:42+00:00

this is my first time asking something here, so don’t be too harsh on

  • 0

this is my first time asking something here, so don’t be too harsh on me please :-). I have a strange “bad access” issue. In a class of mine I have a NSInteger along with a few other members. I override the - (NSString *)description method to print the values of everything like so (omitted the unrelevant part):

- (NSString *)description {
    return [NSString stringWithFormat:@"Duration:%d", duration];
}

and then I print that using NSLog(@"%@", myObject) which is giving me EXC_BAD_ACCESS without any log messages, regardless of the NSZombieEnabled.

  • I have double checked the order of all formatting specifiers and
    parameters – it’s correct.
  • I tried changing the format specifier to %i and %@ and didn’t get any result
  • When I init my object I don’t initialize
    duration. Later, I assign it through a property @property NSInteger
    duration
    . So I tried initializing the duration to 0 in my init
    method but to no avail.
  • If I box duration to a NSNumber prior to
    printing, it works.
  • When I remove the duration and leave all the
    other ivars it works again.

I’m stumped, what am I doing wrong here?
Can you help me?

Thanks a lot!

EDIT: To summarize, It seems this is caused by differences between 32 and 64 bit platforms, because it’s fine when run on an iphone 4 and has issues only when run in the simulator. I tried 3 different approaches – using %d and %i with the NSInteger variable itself, using %qi and using %ld/ %lx and I also tried to cast to int and long with the various format specifiers. Every time I can run on the device, but get EXC_BAD_ACCESS in the simulator.

  • 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-30T21:01:44+00:00Added an answer on May 30, 2026 at 9:01 pm

    The only guess here: NSInteger could be 64 bit in your case and %i (as well as %d) expects 32-bit integer, you can try %qi or (what seems to be better) cast the value explicitly.

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

Sidebar

Related Questions

This is my first time asking a question, please be gentle! I have a
this is my first time posting here, I have a question which I have
this is my first time asking a question here so I hope I am
This is the first time i'm asking a question here at stack overflow so
Well this is not the first time im asking these question here but I
This is my first time using joomla. I don't know if I'm using the
This is my first time with Web services. I have to develop web services
For the first time, I am asking a little bit of help over here
This is my first time asking my question at stackoverflow. I'm working on a
I'm asking this question because it isn't the first time I saw this coding

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.