nstimer

Problems invalidating & re-creating NSTimer(s)

I'm having problems starting & stopping NSTimers. The docs say that a timer is stopped by [timer invalidate]; I have a timer object declared as such .h NSTimer *incrementTimer; @property (nonatomic, retain) NSTimer *incrementTimer; .m @synthesize incrementTimer; -(void)dealloc { [incrementTimer release]; [super dealloc]; } -The u...

NSTimer interval less than sleep command in fired code

I have a snippet of code I want to execute repeatedly, but with the ability to pause and resume it. To do this, I have utilised an NSTimer, which I can stop and start as required. Within the snippet, I use a sleep command to wait for something to update (0.3 seconds). The timer is firing every 0.5 seconds. What would be ideal is to k...

Running NSTimer on a thread

I am trying to run a NSTimer on a thread using iPhone SDK 3.0. I think I am doing everything correctly (new runloop etc.). If I call [timer invalidate] on viewDidDissappear though I get this error: bool _WebTryThreadLock(bool), 0x3986d60: Tried to obtain the web lock from a thread other than the main thread or the web thread. This ma...

NSTimer with a menu bar app

I'm working on a simple timer app, and I've created a NSStatusItem with a menu and I have some NSTextField labels that updates the timer labels (http://cld.ly/e81dqm) but when I click on the status item the NSTimer stops (and stops updating the labels)..... how can I get around this problem? EDIT: here's the code that starts the timer:...

NSTimer on a label

hi, im working with iphone sdk and i got to show a label when the user clik a button but after some time the label deseapear, can i do that? ...

Keep an NSThread containing an NSTimer around indefinitely? (iPhone)

Hi I have some web service data in my app that needs to be updated every 3 minutes. I had tried out a few approaches but got a really good piece of advise in here last week, I should not build a new thread every 3 minutes and then subsequently try and dealloc and synchronize all the different parts so that I avoided memory bug. Instead ...

Timer invalidate

What is the meaning of this statement given? NSTimer *timer ,[timer invalidate] ...

Do I trust ObjectAlloc or Leaks for analyzing my iPhone app?

When I run my iPhone app with "Leaks" (which has a section for Object Alloc), my app seems to be fine for memory allocation. However, when I run it with just the ObjectAlloc tool, the memory increases steadily as the app runs its main timer. (It is a timer based app). I'm not sure what to trust. I was just wondering if there are any ...

Fade In and Out Audio in iPhone SDK

Hi Everyone: I am wondering if there is some way to fade in and out audio using AVAudioPlayer in CocoaTouch, with a pause command once the music finishes fading and then a play command once the fading begins. I have heard that one can use NSTimer for this purpose, but I am unsure of the easiest way to accomplish this. Thanks for any h...

NSTimer crashes iphone simulator on second run

Beginner programmer. Working on a timer app. The following applicationWillTerminate saves the state of started, stopped, startTime and stopTime and invalidates the timer. The intent is to be able to terminate application then restore state and restart timer on app restart. //Save status to file on applicationWillTerminate. - (void)ap...

Iphone app is delayed for 10 -15 minutes when iphone is in sleep mode.

Hello Experts! I have created an app that uses NSTimer, which gets triggered each second. My problem is that if the Iphone is in sleep mode i get a delay for 10 to 15 minutes before the event is triggered. I have stackoverflowed and googled this and the reason for this seems to be that the phone stops listening for certain events when...

Schedule timer with NSTimer makes the task run faster than expected

I schedule a timer with NSTimer's function in viewWillAppear as follows: minutesTimer = nil; minutesTimer = [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(updateScrollViewItems) userInfo:NULL repeats:YES]; With this function call, I expect it to call the selector updateScrollViewItems every minute, but it do...

Timeout a NSThread after a certain amount of time

Hello, I have a NSThread that i would like to timeout after a certain amount of time. [NSThread detachNewThreadSelector:@selector(someFuntion) toTarget:self withObject:nil]; - (void) someFunction { //Some calculation that might take a long time. //if it takes more then 10 seconds i want it to end and display a error message } ...

Change UIButton Background Image more than once per second

I am currently working with the iPhone SDK. I have a NSTimer that changes the background image of a UIButton. Once this is complete, it will trigger the same action again (reset the NSTimer) for a predetermined number of times. My problem is that if my NSTimer is set to execute more than once per second. (0.75, say) The background imag...

iPhone: NSTimer Countdown (Display Minutes:Seconds)

Hello! I have my timer code set up, and it's all kosher, but I want my label to display "Minutes : seconds" instead of just seconds. -(void)countDown{ time -= 1; theTimer.text = [NSString stringWithFormat:@"%i", time]; if(time == 0) { [countDownTimer invalidate]; } } I've already set "time" to 600, or 10 mi...

NSTimer freezes the app until it gets fired again?

Hello all, I have a simple app with a button, UIImageView and a NSTimer. The timer is fired up every 5 seconds repeatedly to update the ImageView with a new image, while the button simply stops the timer and switches to another View. The problem is that when I press the button, nothing happens for a few seconds (until the timer fires up...

Schedule multiple events with NSTimer?

I have a schedule cache stored in a pList. For the example below, I have a schedule time of April 13, 2010 2:00PM and Aril 13, 2010 2:05PM. How can I add both of these to a queue to fire on their own? item 0 -Hour --14 -Minute --00 -Month --04 -Day --13 -Year --2010 item 1 -Hour --14 -Minute --05 -Month --04 -Day --13 -Year --2010 ...

Passing Data thru NSTimer UserInfo

I a trying to pass data thru userInfo for an NSTimer call. What is the best way to do this? I am trying to use an NSDictionary, this is simple enough when I have objective c objects, but what about other data? I want to do something like this, which doesn't work as is: - (void) play:(SystemSoundID)sound target:(id)target callbackSelect...

Why when I render a scene with a revolving camera objects that you'd expect to appear behind others don't do that? OPENGL Objective-c

Hello, I am rendering a scene in which I have two spheres. I am revolving a camera around one of them. What happens is counter-intuitive. When the camera goes around the sphere the other gets in front of it when you'd expect it to be behind. So it appears as though the spheres aren't revolving around each other and the one the should go ...

NSTimer to smooth out playback position

I have an audio player and I want to show the current time of the the playback. I'm using a custom play class. The app downloads the mp3 to a file then plays from the file when 5% has been downloaded. I have a progress view update as the file plays and update a label on each call to the progress view. However, this is jerky... someti...