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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:56:39+00:00 2026-05-27T22:56:39+00:00

Hi I have a NSArray (playersList) containing the following NSManagedObjects : ( <NSManagedObject: 0x6b75980>

  • 0

Hi I have a NSArray (playersList) containing the following NSManagedObjects :

(
    "<NSManagedObject: 0x6b75980> (entity: Players; id: 0x6b749d0 <x-coredata://463316AB-BCF5-4257-AE5B-26E3AAB0DAE1/Players/p1> ; data: { \"id_player\" = 2;\n    name = 7777;\n})",
    "<NSManagedObject: 0x6b759e0> (entity: Players; id: 0x6b749e0 <x-coredata://463316AB-BCF5-4257-AE5B-26E3AAB0DAE1/Players/p2> ; data: { \"id_player\" = 3;\n    name = \"hcp 5\";\n})",
    "<NSManagedObject: 0x6b756d0> (entity: Players; id: 0x6b749c0 <x-coredata://463316AB-BCF5-4257-AE5B-26E3AAB0DAE1/Players/p3> ; data: {\"id_player\" = 4;\n    name = 1;\n})"
)

How can I query it to return the object with ‘id_player==3’?

  • 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-27T22:56:40+00:00Added an answer on May 27, 2026 at 10:56 pm

    There are several ways to do it.

    • iterate the array and just check the id_player property of each object in the array

      NSIndexSet* indexes = [originalArray indexesOfObjectsPassingTest: ^(id obj, NSUInteger idx, BOOL *stop)
                            {
                                return [obj id_player] == 3;
                            }];
      
    • use a predicate (see the predicate programming guide for details)

      NSPredicate* predicate = [NSPredicate predicateWithFormat: @"id_player == %d", 3];
      NSArray* results = [originalArray filteredArrayUsingPRedicate: predicate];
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an NSArray which contains Person objects. This person object contains the following;
I have a NSArray containing objects. I want to create a secondary NSArray containing
I have a NSArray of 'generic Objects' which contain the following properties -name -id
I have an NSArray of objects: MyObject consists of the following string properties: Title
I have an NSArray containing numbers as NSString objects. ie. [array addObject:[NSString stringWithFormat:@%d, 100]];
i have a NSArray containing some NSDictionaries which themselves also include a NSDictionary .
A quick question about NSArrays and NDictionarys. I have and NSArray containing NSDictionarys. The
I have an NSArray containing several NSDictionaries . I have an NSString containing an
I have an NSArray and I'd like to create a new NSArray with objects
I have an NSArray of Foos in an Objective-C program. I would like to

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.