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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:42:20+00:00 2026-05-13T01:42:20+00:00

I am communicating with a webservice to retrieve a numerical value that comes into

  • 0

I am communicating with a webservice to retrieve a numerical value that comes into my function as an NSString. This number tells me the precise amount of time to wait until I perform another action, and it is critical that it be precise.

As an example, if the string is “89283”, then this means I must wait 89.283 seconds. So I’d like to know the best way in Objective-C for iPhone to convert this string to a precise value that I can pass to the performSelector:afterDelay: function. Here’s my sample code, but I’m guessing its not accurate.

NSString *myDelayString = @"89283";
int myDelay = [myDelayString intValue]/1000;
[self performSelector:@selector(myFunction) withObject:nil afterDelay:myDelay];

I think the myDelay value really should be a NSTimeInterval, but I’m not sure how to make that from the string I have. Thanks in advance.

  • 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-13T01:42:20+00:00Added an answer on May 13, 2026 at 1:42 am

    Here is the code with changes to allow double precision.

    NSString *myDelayString = @"89283";
    NSTimeInterval myDelay = [myDelayString doubleValue]/1000;
    [self performSelector:@selector(myFunction) withObject:nil afterDelay:myDelay];
    

    Use doubleValue in order to get the string as a double so you can avoid integer division.
    NSTimeInterval’s type is defined as a double on the iphone, so you can store the double result into it and then pass it to the afterDelay: part of the selector.

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

Sidebar

Related Questions

I'm writing a Cocoa app in Objective C that's communicating with a webservice and
I'm working on a WCF service that will be communicating over net.tcp to n
I have an application in C# (2.0 running on XP embedded) that is communicating
I've read that Silverlight 2.0 imposes by design an asynchronous model when communicating with
I am communicating with a partner's webservice using proxy classes they've provided. I have
I have an ASP.net WebService which uses a Library, this has a dependency on
The webservice on MSDN is now all about the Windows Communication Foundation. Is there
When communicating to a SQL Server database using one of the typical systems, ODBC,
What is best practises for communicating events from a usercontrol to parent control/page i
Why is it not a good idea to use SOAP for communicating with 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.