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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:19:56+00:00 2026-06-05T19:19:56+00:00

This is a continuation of Why do we have to set __block variable to

  • 0

This is a continuation of Why do we have to set __block variable to nil?

basically using block can cause retain cycle in ARC and I still don’t quite get it why

http://developer.apple.com/library/mac/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011226-CH1-SW11

-(void)getReviewAndView{
    if(![[GrabClass grab] cekInet]){return;}
    CM(@"get review and view");
    self.viewlbl.text=@"0 view";
    self.reviewlbl.text=@"0 review";

    Business * businessReviewed = [BNUtilitiesQuick currentBusiness];

    NSString *alamat=[NSString stringWithFormat:@"http://...",businessReviewed.ID];

    CLog(@"alamat:%@", alamat);

    __block NSDictionary * dic = nil;


    [Tools doBackground:^{
        dic=(NSDictionary *)[GrabClass JsonParser:alamat]; //dic get set here
        [Tools doForeGround:^{
            NSString *countView= [[dic objectForKey:businessReviewed.ID] objectForKey:@"CountViews"];

            CLog(@"countView:%@", countView);
            NSString *countReview=[[dic objectForKey:businessReviewed.ID] objectForKey:@"Review"]; //dic get used here
            NSString * reviews=@"review";
            NSString * view=@"view";


            //blablabla

            self.viewlbl.text=[NSString stringWithFormat:@"%@ %@",countView,view ];
            self.reviewlbl.text=[NSString stringWithFormat:@"%@ %@",countReview,reviews];
            dic =nil; //should this be called? What happen if it doesn't?
        }];
    }];
}
  • 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-05T19:19:57+00:00Added an answer on June 5, 2026 at 7:19 pm

    If you don’t know if you have a retain cycle or not, you should run your code under the “Leaks” tool in Instruments and it will tell you about any leaks or retain cycles.

    Also note that in the most recent version of Xcode, the compiler will generate a warning for you if you create one of these parent/block cycles.

    In your case you probably don’t need to worry. dic does not retain the block that references it, so there is no cycle here. But the best way to check is with the Leaks/Allocations instrument.

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

Sidebar

Related Questions

This is a continuation from this post I have a set of random sized
This is a continuation of the question here: JBoss - does app have to
This post is the continuation of my previous post . Now I have a
This post is an continuation of this post I have DlUser Class each object
This is the continuation of the my earlier post Since yesterday I have been
This is a continuation of the question Java rounded Swing JButton . I have
This is sort of a continuation of this question . I have a file
This is a continuation to this question which Oleg has answered. I have 2
This is a Continuation of Jeditable: how to set parameters based on dom element
This is a continuation question from a previous question I have asked I now

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.