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

  • Home
  • SEARCH
  • 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 6774697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:49:07+00:00 2026-05-26T15:49:07+00:00

I have a very simple class called Profile. It contains NSMutableArray called avatar which

  • 0

I have a very simple class called Profile. It contains NSMutableArray called avatar which in its turn contains UIImages. This NSMutableArray is declared as nonatomic,retain property. It is allocated in Profile’s init method like this:

avatar    = [[NSMutableArray alloc] initWithObjects:
                 [UIImage imageNamed:@"image1.png"], 
                 [UIImage imageNamed:@"image2.png"],
                 [UIImage imageNamed:@"image3.png"],
                 [UIImage imageNamed:@"image4.png"],
                 [UIImage imageNamed:@"image5.png"],nil] ;

and released in Profile’s dealloc method.

in my AppDelegate i have global Profile object called currentProfile.It is used in various files. And once i need to release the avatar array of this object in order to copy it with another array. But the copying is never done cause i got runtime error while releasing the array. When i analyze the code i get the following:

Property returns an objective- с object with a + 0 retain count (non-owning reference)

Incorrect decrement of the reference count of an object that is not owned at this time by the caller

What’s wrong? Why can’t i release the array? just because it is a member of a class? if so how can i replace the content of the array with new one?

  • 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-26T15:49:08+00:00Added an answer on May 26, 2026 at 3:49 pm

    well.. if you can’t release it you can always set it to nil, so that it drops the whole content and then you can reassign the array with the new load of data.
    Another solution would be to make a method in the Profile class that makes the = nil + release
    of the array, so that it can be called directly by the other classes that uses that kind of object.

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

Sidebar

Related Questions

So I have a very simple class that has a method called getThumbUrl() but
I have this very simple C++ class: class Tree { public: Node *head; };
Let's say I have a very simple PrototypeJS class that looks like this: var
I have a very simple file watcher class which checks every 2 seconds if
I have a very simple object called CellData. Is defined as: public sealed class
I have a class called Profile that has some simple properties and then it
I have a very simple Person class that has a ivar called name (
I have the following very simple class which looks for the last known user
I have a very simple class with only one field member (e.g. String). Is
i'm missing something fundamental here. i have a very simple custom class that draws

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.