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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:29:45+00:00 2026-06-18T04:29:45+00:00

Im having problems filtering an array using a predicate. My code is this one:

  • 0

Im having problems filtering an array using a predicate. My code is this one:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSError *error;
NSFileManager *fm = [NSFileManager defaultManager];
NSString *filename=[NSString stringWithFormat:@"%@/%lld-%@.jpg",[paths objectAtIndex:0],[TRIP surrogateKey], ms];

NSArray *dirContents = [fm contentsOfDirectoryAtPath:[paths objectAtIndex:0] error:&error];
NSPredicate *fltr = [NSPredicate predicateWithFormat:@"SELF beginsWith %lld-%@",[TRIP surrogateKey], ms];
NSArray *registros=[dirContents filteredArrayUsingPredicate:fltr];

in the debug session i found that i have a problem performing the last line of the code (NSArray *registros=[dirContents filteredArrayUsingPredicate:fltr]) and it gives me the following error:

-[__NSCFString objCType]: unrecognized selector sent to instance 0x7e67200 2013-02-01 16:37:59.132 GastosApp[4462:11303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objCType]: unrecognized selector sent to instance 0x7e67200'

In the debug section i saw that the memory 0x7e67200 is occupied by the ms variable which is declared:

NSMutableString *ms = [[NSMutableString new] autorelease];

Does anyone see any mistake?

Thanks and regards

  • 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-18T04:29:47+00:00Added an answer on June 18, 2026 at 4:29 am

    May be error because NSPredicate make automatic quotation for format variables like %@.

    For example, this:

    [NSPredicate
        predicateWithFormat:@"SELF like[c] %@*%@", prefix, suffix];
    

    Will be as: SELF LIKE[c] "prefix" * "suffix"

    Right way:

    [NSPredicate
        predicateWithFormat:@"SELF like[c] %@",
        [[prefix stringByAppendingString:@"*"] stringByAppendingString:suffix]];
    

    Which give us a correct result: SELF LIKE[c] "prefix*suffix"

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

Sidebar

Related Questions

I've having problems with resource filtering using m2eclipse Maven support in Eclipse. It seems
I am having problems filtering items using Orbeon XForms. The situation is that I
I am having a few problems with Dojo Filtering Selects when using the Zend
I'm having a problems filtering the duplicate values from my query. This is my
I'm having a performance problem with filtering a large NSArray (19k items) for interactive
im having problems on how to save the content of an array in an
I'm pretty new to symfony/Doctrine and having some problems with querybuilder: Given this ER:
I'm having problem filtering an NSScrollViews contents using it's date column. I have an
I'm using jQueryUI AutoComplete but am having a small problem in that no filtering
Having some problems with my Silverlight app (with RIA services) filtering my results. The

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.