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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:24:07+00:00 2026-05-19T01:24:07+00:00

This is driving me nuts so I hope someone can help an Objective-C noob

  • 0

This is driving me nuts so I hope someone can help an Objective-C noob figure this out. Here’s the deal:

I’m developing an iPhone app using Titanium Appcelerator and I’m trying to create an add-on module in XCode that will allow me to send an event to the iPhone calendar. What I’d like to do is to calculate the date and time in terms of seconds since Jan 1, 2001 (GMT) and send it directly to calendar without having to mess with the string-to-date stuff that seems always to return the wrong time. To this point, I’ve not been able to get the integer into the event date fields, both of which are NSDate types.

Titanium takes arguments from Javascript and compiles it into object code, so I can call my “cal” object like this:

var startDate = 316367923;
var endDate = 316367923;    
var results = cal.newEvent(startTime,endTime)

. . . and this is how the “cal” object receives that call:

-(BOOL)newEvent:(id)args {
    id startDate = [args objectAtIndex:0];
    id endDate = [args objectAtIndex:1];
    ...

What I’m hoping to do get these integers into the event object:

EKEventStore *eventDB = [[EKEventStore alloc] init];
EKEvent *theEvent  = [EKEvent eventWithEventStore:eventDB];
...
theEvent.startDate = [[NSDate alloc] initWithTimeIntervalSinceReferenceDate: (int) startDate];
theEvent.endDate   = [[NSDate alloc] initWithTimeIntervalSinceReferenceDate: (int) endDate];

This compiles with no errors but causes my app to bomb nonetheless, so I’m figuring I’ve got something missing in my understanding. Any idea of where I’m going wrong?

Thanks,

Mark

  • 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-19T01:24:08+00:00Added an answer on May 19, 2026 at 1:24 am

    Quite probably ‘args’ is an NSArray, hence startDate and endDate are objects, not literals. You probably want to do something like:

    theEvent.startDate = [[NSDate alloc] initWithTimeIntervalSinceReferenceDate:[startDate intValue]];
    

    If e.g. startDate is an NSNumber. Otherwise, check out the Titanium docs to find out the type of numbers passed in.

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

Sidebar

Related Questions

I'm driving myself nuts with this particular problem, i really hope someone can help!
Ok, this is driving me nuts. I've done just about everything I can to
This has been driving me nuts. I hope it's not been asked before but
CakePHP is driving me nuts! Here is my code: if($this->Page->save($datavalue)) { $this->Session->setFlash('Page content updated
This is driving me nuts! A little piece of code that I can't seem
This is driving me nuts. I am using some 3rd-party code in a Windows
NHibernate is driving me 'Nuts'!!! I have the following mapping. Which returns this error
This is a bit of a long shot, but if anyone can figure it
This is driving me nuts. Its a tough one to explain but I'll have
I'm developing an iPhone app, and I'm kinda new to Objective-C and also 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.