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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:04:03+00:00 2026-05-26T08:04:03+00:00

Please kindly point out what is wrong in my code. I define a variable

  • 0

Please kindly point out what is wrong in my code. I define a variable idleTimer of my custom type

@property (nonatomic, retain) IdleTimer *idleTimer;

Then when I run the following codes, it crashes.

IdleTimer   *idleTimerTemp  =   [[IdleTimer alloc] initTimer:PERIOD_COUPON_POPUP];
idleTimer   = idleTimerTemp;

NSLog(@"Pt. 1 %d %d", [idleTimerTemp retainCount], [idleTimer retainCount]);

[idleTimer setDelegate:self];
[idleTimerTemp release];
NSLog(@"Pt. 2 %d %d", [idleTimerTemp retainCount], [idleTimer retainCount]);

If the idleTimer is used again, it crashes.

But it I retain the idleTimerTemp on “idleTimer = idleTimerTemp”. No crash at all.

But my variable is defined as retain. what is wrong ?

  • 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-26T08:04:03+00:00Added an answer on May 26, 2026 at 8:04 am

    Your property is defined as retain but that doesn’t do anything with respect to the instance variable which is the backing storage for the property. Presumably somewhere in your code, you’ve done an @synthesize idleTimer;. That creates an accessor pair which implements the memory management you requested.

    The only way to get that behavior is to call the accessor itself. So if you assign directly to idleTimer, that does nothing, but if you use self.idleTimer = idleTimerTemp, then the -setIdleTimer: accessor gets called, which will retain the parameter.

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

Sidebar

Related Questions

I'm puzzled here, and kindly request your help. VC2005SP1 swallows this (stripped out) code
amm please kindly check this code? cos it won't work.. <?php $page = file_get_contents(http://natadec0c0.tumblr.com/);
Could anyone please tell me if there is any code to convert floating point
Please kindly help me in the following, I have $sub = C:\views\sght\gzad\text\hksdk\akldls\hool.java = C:\views\sght\bdsk\text\hksdfg\sdjks\same.java
Please kindly advise on benchmarks used to test a C and C++ allocator? Benchmarks
Please guide what is meaning by Web is stateless in simple words ? Kindly
A nice chap called Darin kindly provided me with some code in order for
The post is updated. Please kindly jump to the Solution part, if you've already
Greetings! Can anyone please kindly assist me finding a way around the following: load
If it must implement with AIDL? And please kindly provide an example, thanks. EDIT:

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.