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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:54:10+00:00 2026-05-25T13:54:10+00:00

i have a NSArray containing some NSDictionaries which themselves also include a NSDictionary .

  • 0

i have a NSArray containing some NSDictionaries which themselves also include a NSDictionary.

NSDictionary *dict1 = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:@"cover" forKey:@"type"] forKey:@"image"];
NSDictionary *dict2 = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:@"cover" forKey:@"type"] forKey:@"image"];
NSDictionary *dict3 = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:@"back" forKey:@"type"] forKey:@"image"];
NSDictionary *dict4 = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:@"cover" forKey:@"type"] forKey:@"image"];

NSArray *myArray = [NSArray arrayWithObjects:dict1, dict2, dict3, dict4, nil];

is there a way to filter myArray for all Image-Dictionaries where the type is f.e. “cover” using a NSPredicate?

tried predicates like

predicateWithFormat:@"(SELF.image.type == %@)", @"cover"]

or

predicateWithFormat:@"(image.type == %@)", @"cover"]

but without success.

thanks in advance! leave a comment if something is unclear

// edit

so

NSPredicate *p = [NSPredicate predicateWithFormat:@"image.type == %@", @"cover"];

is working. but in my case i want to sort out size == original. what i did is

NSPredicate *p = [NSPredicate predicateWithFormat:@"image.size == %@", @"original"];

but then my app crashes with

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSSymbolicExpression length]: unrecognized selector sent to instance

and pointing to my filteredArrayUsingPredicate method. i cannot see any difference between type and size. see my NSLog of my Array here

 (
        {
        image =         {
            height = 1500;
            id = 4e5808765e73d607350059b4;
            size = original;
            type = poster;
            url = "someurl";
            width = 1000;
        };
    },
        {
        image =         {
            height = 750;
            id = 4e5808765e73d607350059b4;
            size = mid;
            type = poster;
            url = "someurl";
            width = 500;
        };
    },

anybody knows why it crashes when i try to use size instead of type ?

  • 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-25T13:54:10+00:00Added an answer on May 25, 2026 at 1:54 pm

    The following code worked for me:

    NSDictionary *dict1 = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:@"cover" forKey:@"type"] forKey:@"image"];
    NSDictionary *dict2 = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:@"cover" forKey:@"type"] forKey:@"image"];
    NSDictionary *dict3 = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:@"back" forKey:@"type"] forKey:@"image"];
    NSDictionary *dict4 = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:@"cover" forKey:@"type"] forKey:@"image"];
    
    NSArray *myArray = [NSArray arrayWithObjects:dict1, dict2, dict3, dict4, nil];
    
    NSPredicate *p = [NSPredicate predicateWithFormat:@"image.type == %@", @"cover"];
    NSLog(@"%@", [myArray filteredArrayUsingPredicate:p]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an NSArray containing several NSDictionaries . I have an NSString containing an
I have an NSArray containing numbers as NSString objects. ie. [array addObject:[NSString stringWithFormat:@%d, 100]];
Hi I have an NSArray containing many 'multimedia action' as I like to call
Another puzzler. I have an NSArray (iTours) containing 3 Objects and a retain count
I have numerous classes that use the various NSDictionary/NSArray collection classes as ivars but
i have a input tag which is non editable, but some times i need
I have a retain property, which is an NSArray of child View controllers. I
I have an NSArray containing date/time NSStrings in the following format: 2/2/2011 2:46:39 PM
I am facing a very regular scenario. I have an NSArray which has object
I have a property called data of type NSArray in InventoryFilteredTVC and here's a

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.