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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:04:06+00:00 2026-06-11T06:04:06+00:00

I’m getting the weirdest error when I run this on my device (but not

  • 0

I’m getting the weirdest error when I run this on my device (but not on simulator):

I am getting a date from a JSON object, like this:

NSDateFormatter *df = [[NSDateFormatter alloc]init];
[df setDateFormat:@"EEE MMM d HH:mm:ss Z yyyy"];
NSDate *dateX = [df dateFromString: [info objectForKey:@"created_at"]];


NSUInteger desiredComponents = NSYearCalendarUnit | NSMonthCalendarUnit  | 
                               NSWeekCalendarUnit | NSHourCalendarUnit   | 
                               NSDayCalendarUnit  | NSMinuteCalendarUnit | 
                               NSSecondCalendarUnit;

NSDateComponents *elapsedTimeUnits = [[NSCalendar currentCalendar] 
                                      components:desiredComponents
                                      fromDate:dateX
                                      toDate:[NSDate date]
                                      options:0];

As you can see, I use the formatter to convert the string into a date, which works. Then I create the NSDateComponents, and later use that to do elapsedTimeUnits.hour and .day etc. to calculate the amount of time from dateX to NSDate date(NOW).

And it works! Or so I thougt, while testing everything on the simulator.

I just got this insane errormessage saying dateX was nil, but only when I ran it on my device. So every time I run this in the simulator, it shows the correct amount of time from the date. When I run it on the device, it shows one specific date, which is 4 weeks, 1 day and 23 hours ago. I have NSLogged out the [info objectForKey:@"created_at"], and knows it gets the correct date as input to begin with. Apparently, the app can’t do the converting from string to date on the device, but on the simulator. Everything from here on out is the output I get:

2012-08-31 00:26:19.773 App[1676:907] *** -[__NSCFCalendar 
components:fromDate:toDate:options:]: fromDate cannot be nil

I mean really, what do you think that operation is supposed to mean with a nil fromDate?

An exception has been avoided for now.

A few of these errors are going to be reported with this complaint, 
then further violations will simply silently do whatever random thing 
results from the nil.

Here is the backtrace where this occurred this time 
(some frames may be missing due to compiler optimizations):

(

0   CoreFoundation                      0x36a5e8bf <redacted> + 86

1   App                                0x00082d67 -[NewsViewController tableView:cellForRowAtIndexPath:] + 478

2   UIKit                               0x384d1b81 <redacted> + 412

3   UIKit                               0x384b693b <redacted> + 1310

4   UIKit                               0x384cde17 <redacted> + 206

5   UIKit                               0x38489f2b <redacted> + 258

6   QuartzCore                          0x357d7e9b <redacted> + 214

7   QuartzCore                          0x357d7a39 <redacted> + 460

8   QuartzCore                          0x357d8975 <redacted> + 16

9   QuartzCore                          0x357d8353 <redacted> + 238

10  QuartzCore                          0x357d8161 <redacted> + 316

11  UIKit                               0x3849000b <redacted> + 126

12  CoreFoundation                      0x36a8caed <redacted> + 20

13  CoreFoundation                      0x36a8ade1 <redacted> + 276

14  CoreFoundation                      0x36a8b137 <redacted> + 742

15  CoreFoundation                      0x369fe39d CFRunLoopRunSpecific + 356

16  CoreFoundation                      0x369fe229 CFRunLoopRunInMode + 104

17  GraphicsServices                    0x353b331b GSEventRunModal + 74

18  UIKit                               0x384da8f9 UIApplicationMain + 1120

19  App                                0x0006107f main + 86

20  App                                0x0005f450 start + 40

)
  • 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-11T06:04:08+00:00Added an answer on June 11, 2026 at 6:04 am

    Check your Settings on the device and make sure that 12/24 hour mode is consistent with the device locale. (12 hours in the US, 24 in most other parts of the world.)

    Dollars to donuts they’re in conflict, bumping you into a iOS “feechure”.

    See this thread.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,

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.