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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:25:04+00:00 2026-05-15T08:25:04+00:00

I have some XML data retrieved from a web service that I use to

  • 0

I have some XML data retrieved from a web service that I use to create NSManagedObjects and store in a sqlite3 backing store. In my app, I’m using NSPredicate objects to query this data by date (along with other fields). The data I have has records for every day from April 2009 through August 2010 (according to the raw XML I retrieved from the SOAP web service).

Here’s a little setup:

NSCalendar *cal = [NSCalendar currentCalendar];

NSDate *today = [cal dateFromComponents:[cal components:NSDayCalendarUnit|NSMonthCalendarUnit|NSYearCalendarUnit
                                               fromDate:[NSDate date]]];
NSDate *day1ahead = [cal dateFromComponents:[cal components:NSDayCalendarUnit|NSMonthCalendarUnit|NSYearCalendarUnit
                                                   fromDate:[NSDate dateWithTimeIntervalSinceNow:kSecondsPerDay]]];
NSDate *day2ahead = [cal dateFromComponents:[cal components:NSDayCalendarUnit|NSMonthCalendarUnit|NSYearCalendarUnit
                                                   fromDate:[NSDate dateWithTimeIntervalSinceNOw:kSecondsPerDay*2]]];

I am able successfully retrieve NSManagedObjects using an NSPredicate query like this:

NSPredicate *todaysData = [NSPredicate predicateWithFormat:@"(StartDate >= %@) AND (StartDate <= %@)", today, day1ahead];

However, when I do a query like the next one, I get bupkis.

NSPredicate *tomorrowsData = [NSPredicate predicateWithFormat:@"(StartDate >= %@) AND (StartDate <= %@)", day1ahead, day2ahead];

I checked the XML data, and the future dates for which I’m trying to query are there, and I also checked the sqlite3 backing store directly like this:

sqlite> select datetime(startdate, "unixepoch", "31 years") from mydatatable;

The results of this simple query show that the future dates I’m after are there.

I even tried a query like this:

NSPredicate *allFuture = [NSPredicate predicateWithFormat:@"(StartDate >= %@)", today];

The results did not include anything beyond the current day. It seems to be in the backing store, so I’m a bit at a loss as to why the NSPredicate objects aren’t working the way I expect them to.

Is there a way to see the actual SQL statements generated by CoreData so I can see truly what’s going on? Am I looking at the data wrong in the sqlite3 db? Is there something else obvious that I’m missing?

  • 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-15T08:25:05+00:00Added an answer on May 15, 2026 at 8:25 am

    Is there a way to see the actual SQL statements generated by CoreData so I can see truly what’s going on?

    Yes. In your Active Executable settings in Xcode, add -com.apple.CoreData.SQLDebug 1 to the “Arguments to be passed on launch” list and check the checkmark. Core Data will then NSLog its SQL queries.

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

Sidebar

Related Questions

I have some data retrieved from web in following format (in a stream): {parts:[
I have xml data that is retrieved from a server and I need to
I have some data in a database that I need represented in an XML
I have one problem , I want to get some data from XML file
I have a file which is an XML representation of some data that is
I have been having some issues retrieving JSON data from a WCF service application
I have some code to retrieve XML data: import cStringIO import pycurl from xml.etree
I've built a web part for Sharepoint that retrieves data from an external service.
Im writing an iPhone app which retrieves data from a web service as XML.
I have some xml data contained in three files (Database.xml, Participants.xml, and ConditionTokens.xml). I

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.