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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:22:38+00:00 2026-06-16T22:22:38+00:00

I have an NSMutableArray of Model objects. Each Model Object has a startTime property

  • 0

I have an NSMutableArray of Model objects.

Each Model Object has a startTime property of NSDate type

I would like to using NSPredicate to filter the NSMutableArray.
I want an array with items older then now and one with items newer then now.

This is the code im using but the filtered arrays are empty. I do make sure there are items in the primary array im filtering from.

    NSPredicate *pastPredicate = [NSPredicate predicateWithFormat:@"(startTime < %@)", [NSDate date]];
    NSPredicate *futurePredicate = [NSPredicate predicateWithFormat:@"(startTime >= %@)", [NSDate date]];

    self.pastReservations = [self.reservations filteredArrayUsingPredicate:pastPredicate];
    self.futureReservations = [self.reservations filteredArrayUsingPredicate:futurePredicate];

Can you guys let me know if you know what I’m doing wrong? I dont think I should have to use a block for predicate using a built in 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-06-16T22:22:40+00:00Added an answer on June 16, 2026 at 10:22 pm

    My code was correct. There was code before that was not working right and self.reservations was empty like Ramy Al Zuhouri said.

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

Sidebar

Related Questions

In my model I have an array of objects called events. I would like
I have an NSMutableArray which has five objects in it. I want to insert
I have a NSMutableArray of objects, below is the struct: //object at index i
I have a NSMutableArray pages with several objects (instances of Page ). Each Page
in a simple drawing application I have a model which has a NSMutableArray curvedPaths
I have an NSMutableArray property defined in my Brain model. @property (retain, nonatomic) NSMutableArray
In my Brain model I have an NSMutableArray property called stockCars which holds 8
I have a NSMutableArray which contains NSMutableDictionaries .I would like to display one string
i have NSMutableArray contains NSArray Objects, it looks like this ( 2012-10-10 13:13:29 +0000,
I have a NSMutableArray and it has the users high scores saved into it.

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.