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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:46:21+00:00 2026-05-22T20:46:21+00:00

I’m using a NSOperation to handle background processing in an iOS app, and I’m

  • 0

I’m using a NSOperation to handle background processing in an iOS app, and I’m trying to understand the target/action pattern. In the delegate pattern, the delegate is held as a weak reference, and the delegate object is responsible for setting the other object’s delegate field to nil before it deallocs. In the target/action pattern, as I understand it, the target is held as a weak reference, for similar reasons. However, it doesn’t seem as easy to “nil out” the target field when the target object deallocs, and with NSOperations there is a chance the operation could still be sitting on a queue when its target is deallocated.

How should memory management be handled in this case (of a NSOperation performing background processing, then using target/action to return a value to the creator of the NSOperation)?

  • 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-22T20:46:22+00:00Added an answer on May 22, 2026 at 8:46 pm

    As explained in The Target, it’s up to you to make sure that the target is available if a control might send an action. In practice, this isn’t a problem because the target is usually a controller that’s created before and deallocated after the controls.

    If you’re sending action messages from an operation, you’ll need to ensure that the target isn’t deallocated until after the operation completes. One way to do that might be to have the target retain itself until the operation completes.

    Another approach might be to use an intermediate object that’s known to both the operation and the target. The operation could treat the intermediate object like a proxy for the target and send the action to it rather than sending it directly to the target, and the target could update the intermediate appropriately if it’s deallocated. Both the target and the operation could retain the intermediate without creating a retain cycle. I’m not sure this method would be my first choice — seems a little overcomplicated — but it might help.

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

Sidebar

Related Questions

I am using Paperclip to handle profile photo uploads in my app. They upload
I am trying to understand how to use SyndicationItem to display feed which is
We're building an app, our first using Rails 3, and we're having to build
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.