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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:31:35+00:00 2026-06-01T15:31:35+00:00

in this code, if collection is released in the class that called init… ,

  • 0

in this code, if collection is released in the class that called init..., what will happen to self.title or self.managedObjectContext? Don’t we have to call .itemName on currentCollection rather than on collection itself?

- (id)initWithCollection:(AACollection *)collection {
    if( (self = [super initWithNibName:@"AACollectionViewController" 
                                bundle:nil]) ) {
        currentCollection = [collection retain];
        self.title = collection.itemName;
        self.managedObjectContext = collection.managedObjectContext;
    }

Thanks

  • 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-01T15:31:37+00:00Added an answer on June 1, 2026 at 3:31 pm

    what will happen to self.title or self.managedObjectContext?

    You’re retaining collection, so nothing bad will happen. That said, it’s generally a good idea to give your string properties copy semantics. For example, assuming title is a string property, if collection.itemName happens to give you a mutable string, you really want to make an immutable copy of it so that it won’t be changed right under your nose (which could happen if you just reference the mutable string). Using copy will do that for you.

    Don’t we have to call .itemName on currentCollection rather than on collection itself?

    No. currentCollection and collection will point to the same object. It’s the object that’s retained, not the pointer. Some might consider it better style to use currentCollection, but it’s effectively the same thing either way.

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

Sidebar

Related Questions

Why this code shows 0? Shouldn't it return 1? Messages = new Meteor.Collection(messages); if
I have A WCF service that has a class that inherits System.Web.Security.RoleProvider. In this
iam making one applciation.In that iam using the NSUrlconnection class.Below one is my code.
In the code below: DbModels.prototype.updateById = function(_collection, id, field, value, callback) { this.getCollection(_collection, function(error,
This code using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.Entity; using System.Data.Entity.ModelConfiguration;
I have this code (C#): using System.Collections.Generic; namespace ConsoleApplication1 { public struct Thing {
I'm using this code: Dim cListItems As New System.Collections.Generic.List(Of Combobox_values) cListItems.Add(New Combobox_values(One, 1)) cListItems.Add(New
This C#/WPF code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using
The code below produces a NumberFormatException in this line: val cache = cf.createCache(Collections.emptyMap()) Do
Im using this code for mysql connection $con = mysql_connect(localhost:/var/lib/mysql/mysql.sock, abc , xyz); if

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.