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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:32:47+00:00 2026-05-22T17:32:47+00:00

my code is crashing because of this problem: if ([recorder peakPowerForChannel:0]==0 ) { NSLog(@we

  • 0

my code is crashing because of this problem:

if ([recorder peakPowerForChannel:0]==0 )
{       
    NSLog(@"we are recording now because signal is at high volume... ");
    if(flag==1)
    {
        start = [NSDate date];       
    }
    [recorder stop];            
}
else 
{
    [recorder stop];    
    stop = [NSDate date];
    duration = [start timeIntervalSinceDate:stop];

stop and start are NSDate and declared at the start of the .m
,The problem is that because “duration” and “start” are not in the same “if”, and moving “start” to be under the “else” solve it. but i need it to be there.

why is that happen? the software is going for sure to the “start” before she goes to the stop, so does he forget the start?

  • 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-22T17:32:48+00:00Added an answer on May 22, 2026 at 5:32 pm

    The [NSDate date] gives a autoreleased object to the caller.
    Change start = [NSDate date]; to start = [[NSDate date] retain]; and you should be fine.

    Then you have to balance the retain counts in the end.

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

Sidebar

Related Questions

My app is crashing after loading thumbnails. On this line the code is downloading
I have a problem with my code. It keeps on crashing when i have
My app is crashing in iOS 5 because I have some code that is
How can I prevent the following code crashing my program? ::MessageBox(NULL, Lbefore, NULL, MB_OK);
Code which I have inherited keeps crashing out rather powerfully with the following error
I got some code of a fellow stackflower and for some reason, it's crashing
I'm very frustrated with this problem. After one week of waiting my universal iPad
So this problem is a little bit complicated to understand what I'm trying to
The title explains all... I have this snippet of code in my application: String
I have a managed code Windows Service application that is crashing occasionally in production

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.