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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:38:04+00:00 2026-06-13T13:38:04+00:00

[NSArray containsObject] use isEqual. isEqual default to the address. Say I want to know

  • 0

[NSArray containsObject] use isEqual. isEqual default to the address.

Say I want to know if [NSArray containsObject] based on reference? So I want to know whether that actual object, rather than an object eQual to it, is in the array.

I want to use it for to compare core data objects. Core data objects may be deleted and dereferenced and I wonder what happen to all array that contain elements that reference it.

  • 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-13T13:38:06+00:00Added an answer on June 13, 2026 at 1:38 pm

    isEqual default to the address

    And in that case, is there a problem?

    It sounds like you want to store objects where isEqual does not use the address, but still use the address for this check, right?

    There’s no -[containsObjectIdenticalTo:], but there is an -[indexOfObjectIdenticalTo:]; if that returns anything but NSNotFound, it’s contained.

    if ([anArray indexOfObjectIdenticalTo:anObject] != NSNotFound) {
    }
    

    As the NSArray reference docs make clear:

    Objects are considered identical if their object addresses are the same.

    There’s a whole family of Identical methods on NSArray and other collections, that are there exactly for this purpose.

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

Sidebar

Related Questions

NSArray* address = [NSArray arrayWithArray:[detailItem addressArray]]; NSLog(@address = %@, address); NSString* addressToString = @;
DBPostListViewController has a NSArray *postList that needs to be set. I keep getting Terminating
I have created one NSarray , Now I want to display it's data in
I have an NSArray that contains a couple of items. The NSArray is loaded
So I want to know if this is a good idea or a bad
I have an NSArray which contains Person objects. This person object contains the following;
So I have a nsarray (there will be lots of those) and I want
I have an NSArray which contains NSDictionary objects with keys that are NSNumber objects.
+ (NSArray*) queryAllByEntityName:(NSString*) name AndSortColumn:(NSString*) ptyName{ //Define our entity to use NSEntityDescription *entity =
I have an app (using retain/release, not GC) that maintains an NSArray instance variable,

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.