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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:16:01+00:00 2026-06-13T00:16:01+00:00

I came around a interesting issue while working on my app. Imagine the scenerio

  • 0

I came around a interesting issue while working on my app. Imagine the scenerio where

  • There exist one object, Lets call it A.
  • A, then creates an object(B) of some delegation based class, say NSURLConnection.
  • A assigned itself as delegate of B, provided A has implemented all the required delegate methods.
  • A asks B to start its processing. In our example i.e. fetching data from some server.
  • As soon as B finished fetching data, it will call some specified method of A.

In the last step, suppose while calling the methods of A, B finds that the A object doesnt exist anymore. Then what happens???

I’m not sure but does it cause crash?

If yes, then please suggest me how to avoid the situation.

In my case I assigned the viewcontroller as delegate of some object, say X in viewDidLoad method. There are cases when viewcontroller get destroyed before X calls the delegate methods defined in the viewcontroller.

  • If assigning X’s delegate to nil solves the problem. Then where
    should i do that.

In short, which method is called only once while unloading phase of view controller likewise
viewDidLoad in its loading phase.

  • 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-06-13T00:16:02+00:00Added an answer on June 13, 2026 at 12:16 am

    Checking against a valid delegate object should be sufficient enough.

    if (delegate)
       [delegate method];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While I was playing around with pdfbox 1.7.0 (apache) I came across a NullPointerException
While moving some code around for investigation purposes, I came across a little feature
I'm working on my own implementation of the JVM and came around to the
I searched around for a while and only came up wit solutions that added
While reverse engineering I came around a very odd program that uses a calling
I came upon an interesting discussion with my team around the use of HttpRequest.UrlReferrer
I came around some weird thing in MS SQL server. I have two tables
Coding i came around to check for the vararg performance of Java. I write
I'm playing around with list comprehensions and I came across this little snippet on
So I'm playing around with JavaScript and came across what I think to 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.