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

  • Home
  • SEARCH
  • 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 6999503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:32:59+00:00 2026-05-27T20:32:59+00:00

I have a managed object reference *event. An Event has many Occurrences. An Occurrence

  • 0

I have a managed object reference *event.

An Event has many Occurrences. An Occurrence has an attribute call date

I want to fetch all the occurrences of the event *event which has today’s date. How should I write a NSPredicate on a FetchRequest.

  • 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-27T20:33:00+00:00Added an answer on May 27, 2026 at 8:33 pm

    You have to be aware, that there are two ways to get your Occurrence objects: You can traverse the relationship from the Event object (i.e. myEvent.occurences) or you can create a fetch request for all occurrences that have the event of interest in their inverse relationship, i.e. a predicate like [NSPredicate predicateWithFormat:@"event == %@", myEvent"].

    There are fundamental differences to these two. A fetch request will always cause SQL to be executed and I/O to happen which is expensive. If you simply traverse the relationship, and you’re in a situation where the Occurrence objects are already in memory, it will be very cheap to do (no SQL, no I/O). The fetch request on the other hand, will allow you to fault in all objects in one go, while traversing will only fault objects one at a time, so you’ll end up doing multiple SQL + I/O events. Also, a fetch request allows you to limit the predicate even further. But in many cases, simply traversing might be the best case.

    CoreData does a lot of heavy lifting for you, but at the end of the day, you still need to know about when to do SQL and I/O and how to prevent it.

    I hope this helps.

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

Sidebar

Related Questions

I have a fairly involved managed data model which has a central object with
I'm sure we all have received the wonderfully vague Object reference not set to
In my Core Data managed object model, I have an entity Foo with a
Is the SqlClient.SqlDataReader a .NET managed object or not? Why do we have to
Is it possible to perform a global reversed-find on NHibernate-managed objects? Specifically, I have
In an embedded program I have a screen object that needs to manage a
I have managed to set up Cassandra + Thrift and the Python wrapper for
I have managed to get a cron job to run a rake task by
I have managed to create a custom action in C# using MakeSfxCA which is
If I have managed to locate and verify the existence of a file using

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.