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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:29:12+00:00 2026-05-28T03:29:12+00:00

First, I should say I’m using ARC, so retain is not an option. The

  • 0

First, I should say I’m using ARC, so retain is not an option. The object’s class is of type NSViewController and has two NSTimers as well as several textfields and buttons. The odd thing is that when the two timers are invalidated, it looks like the object is being released. This is a problem because sometimes I just want to pause or restart them, which means I have to invalidate them, but once I do, the reference is lost, and any message to the object will throw a EXC BAD ACCESS.

I’m not very familiar with memory management or ARC but why is the reference lost depending only on the timers? I mean, just because they’re invalidated does not mean I don’t need the object anymore.

I’ve tried declaring the timers as instance variables and properties but nothing changed.

What I really need is for the reference not to be retained, even when both timers are invalidated. What am I doing 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-28T03:29:13+00:00Added an answer on May 28, 2026 at 3:29 am

    NSTimer retains its target, so if it is the only reference to the object it will be deallocated when the timer is invalidated. You’ll have to take ownership of your object, preferably by making it a declared strong property.

    Edit: Changed “delegate” to “target”;

    Yes, you’ll have to declare a property and (possibly) an instance variable for it.
    The release notes give a good example, there are a couple other good intros around. Make sure that you invalidate the timer if your owner class is ever deallocated, otherwise your view controller will hang around.

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

Sidebar

Related Questions

[1] In JDBC, why should we first load drivers using Class.forName(some driver name). Why
First of all I should probably say that the term 'constant object' is probably
First off I should say that I don't have any experience in working with
Maybe somebody could help me. I need a two methods. The first should open
I'm opening a file, and getting lines from it. The first line should say
First of all, I should say that I'm starting to learn git so that
First, I should say that I am a beginner in terms of XSLT. Although
First I should say I only started learning HTML,PHP,Jquery a couple of weeks ago
Maybe I should first give an idea of what I want to accomplish as
I had a requirement where in the text field the first character should be

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.