Questions tagged [nstimer]

An Objective C class for creating timer objects.

-1
votes
0answers
14 views

Issue with NStimer [duplicate]

I want a timer to go for 20 seconds, I trigger an NSTimer from a button in an alert view: [alert addAction:[UIAlertAction actionWithTitle:@"Start Measurement" style:UIAlertActionStyleDefault ...
0
votes
1answer
42 views

NSTimer iterating by 4

I have a timer that I want to iterate once every second, but the counter is iterating by 4 each time and I'm not sure why. it prints: 4,4,8,8,12,12,16,16,20 timer = [NSTimer ...
0
votes
0answers
34 views

How to build a timer Like SPI cinemas booking page timer in iOS? (Swift Animation)

I want a timer like this it flips each second , my plan was to use labels for that and update the using timer class but how will u animate the label like turing a calender every second. I tried ...
0
votes
0answers
27 views

Signal SIGABRT regularly when running Swift app in Xcode [duplicate]

I'm just starting to learn some ios development in Xcode and I am following an online tutorial. It seems though that very regularly my app crashes when I run it and I get the dreaded Signal SIGABRT ...
0
votes
0answers
29 views

SWIFT : Can we instantiate a new timer() or nsTimer with different interval in selector method?

I am creating a timer which has varying time intervals. I have used Timer object of Swift. In the main loop I init timer and set repeatability false. In the selector function, I invalidate old timer ...
-6
votes
1answer
50 views

Transition to view through the timer [closed]

I need to implement a smooth transition to another View using a timer. For example, when I click on the start button and after 15 seconds pass, the automatic transition to another View takes place.
0
votes
0answers
15 views

Does NSTimer works in conjunction with device's clock?

If we manually change the clock time of device, will the NSTimer output change? I want to show a count down, but I am not sure if user will change the device in-between then will it change the NSTimer ...
0
votes
0answers
17 views

Why is my timer's tolerance always halved?

In my app, I'm scheduling a timer like this: let period = TimeInterval(10) let timer = Timer.scheduledTimer(withTimeInterval: period, repeats: true, block: { [weak self] (_) in // Some repeating ...
0
votes
1answer
35 views

Should I write NSTimer code in view controller or separate class with either delegation/notification pattern?

I have 5 buttons in my MotorViewController that act as on/off switches for 5 motors. Press button A, motor A will run indefinitely 'til you press the button again to stop it. I've just added a 6th ...
0
votes
1answer
30 views

work with UIPagecontrol using NSTimer in swift4

I am trying to add the UIPagecontrol using NSTimer for images sliding. but not able to get it. I have tried something which is given below. import UIKit class ViewController: UIViewController { ...
1
vote
1answer
26 views

How to fix “ Incompatible pointer types sending 'void (void)' to parameter of type 'SEL _Nonnull' ” in NSTimer

In Objective C, I am trying to create the method that it's called at the NSTimer selector within the constructor. However, I'm getting this error which causing my app to fail when I build it: ...
0
votes
1answer
38 views

Is this correct for a NSTimer to get run on the main thread?

Hello I wanted to run a NSTimer on the main thread im not sure if they are run on the main thread by default or I have to do a special implementation ? thanks to anyone who could help @interface ...
0
votes
0answers
46 views

cellForRowAtIndexPath not correctly presenting cells, when used with NSTimer

I have weird situation. I have tableview with photos. I can add new photos in tableview using some button. Before appearing on tableview cell should show progressView for random number of seconds. For ...
-2
votes
2answers
84 views

How to work with Page control using NSTimer for automatic scrolling in swift4

I am new to iOS.I am trying to do the page control using NSTimer for automatic scrolling and also I want to change the shape of dots in page control .I need page control with rectangle boxes.If anyone ...
0
votes
2answers
75 views

Timer Updating Label 1 Second Behind 2nd Timer Counting Down

I'm having difficulties attempting to link two timers together. I'm trying to have a timer count down from a specified amount and to have a second timer constantly updating a label on a view ...
0
votes
1answer
52 views

NSTimer Issues to start image slideshow automatically

I'm discovering issues on attempting to start image slideshow on my app after launching splash screen. For some reason the image slideshow takes too long to start I had to click either previous button ...
0
votes
1answer
74 views

Remove focus from UIButton in tvOS

So I'm writing my first tvOS App (Objective C) and am having some fun with the "Focus Engine". My app is a 2 page app with a Tab Bar controller, on the main page I have a few UIButtons. On app startup ...
0
votes
3answers
67 views

Swift | The timer wont stop on invalidate call, rather speeds up?

i have made a stop watch using Timer in this app and added start stop button to pause and play the same. When the press button is pressed, it is sent to a function which invalidates the timer and it ...
0
votes
1answer
71 views

Is there a good way to check when a variable stop changing its value after continuously changing for a while?

I'm trying to check a variable declared as @property (assign, nonatomic) NSTimeInterval rate; which is changing constantly as a time counter. In other words, the variable's value is changing ...
0
votes
2answers
66 views

How to add year and month in count down Timer Objective C

Right now I have added seconds and min. in my timer. Additionally I need to add Hours month and year in my timer like below image: Here is the code which I have implemented : // CountDown ...
1
vote
1answer
112 views

How to use a timer to stop a long-running function? Swift 4

I have a function that runs for a long time, and I'd like to give it a cap of 10 seconds if possible. I'd also like to implement a Cancel button for the user to press as well. I tried simply checking ...
1
vote
2answers
62 views

Audio voiceover when iPhone is locked

Solution below I am working on a running app which gives voiceover instruction at the start of each exercise. It works as intended when the device is active but doesn't work when the phone is locked. ...
-3
votes
1answer
123 views

timer doesn't work in cocoa/mac OS in Swift 4

I cant see why this time doesnt update. Been looking the entire day. I don't know if is something related to being my first MacOs project, and there's maybe something that's escaping me, but I'd love ...
0
votes
1answer
32 views

Calling A Function Before NSTimer Fires

I have an NSTimer which fires after 1 minutes but I want to display a warning when the remaining time till fire is 10 seconds. How do I present an alert when the remaining time is 10 seconds?
-6
votes
1answer
83 views

All digits not shown in timer countdown

While coming to a view I call a function to load a timer like so... var count = 10 func startTimer() { timer = Timer.scheduledTimer(timeInterval: 0.4, target: self, selector: #selector(...
0
votes
1answer
54 views

iOS - How to start a new line in UITextView while streaming from remote service

In my ios application, I am streaming text from a remote service to a UITextView. @IBOutlet weak var streamingResult: UITextView! // Store streaming results in a String called results var ...
0
votes
1answer
40 views

Fire timer only when system is awake (macOS)

I'm developing a mac app that makes network calls. I am using a Timer to make a network call every 15 mins to refresh some data. I only want the timer to fire and the call to be made when the user is ...
3
votes
4answers
105 views

Swift creation of separate timers

I am trying to make a countdown timer that connects to a button, and am currently using the timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(ViewController.clock), ...
1
vote
0answers
35 views

Timer invoke its block so quickly when enter background and enter foreground after a while

let _ = Timer.scheduledTimer(withTimeInterval: 4.0, repeats: true) { (timer) in //do something } I create a timer and invoke its block every 4 second. Then I make application to enter ...
2
votes
2answers
94 views

Why timer invoke its block so quickly sometimes

I create a timer and invoke its block every 5 second. Then I make application to enter background and enter foreground after a while. But it could invoke the block quickly sometimes. let _ = Timer....
-1
votes
2answers
48 views

Timer keeps working after invalidate() and nil

I have this timer: class InstallationViewController: BaseViewController { var precentageTimer: Timer! } In the same class I am starting the timer like so: self.precentageTimer = ...
0
votes
1answer
41 views

Is it possible to run a scheduled timer in a suspended app?

I've read several posts on creating a timer that runs in the background. Is it possible to create a scheduled timer that will continue to run once the app has been suspended/terminated? Apple's own ...
0
votes
3answers
35 views

Will subview UIView get any callback when the containing UIViewController viewWillDisappear gets called

I have a custom control which i have added to view of UIViewController, it has a timer in it and my requirement is to stop the timer when ViewController disappears(ie let us say new ViewController ...
4
votes
1answer
116 views

Most Accurate Timer on MacOS

I have an app that reads environmental data from a USB sensor connected to a Mac. Users are able to configure how often the app samples data and how often the app averages those samples and logs the ...
0
votes
1answer
48 views

Why NSTimer sends positions every 5 seconds instead of every 60?

Why NSTimer sends positions every 5 seconds instead of every 60? - (void)startTimer { self.timer = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self ...
0
votes
1answer
41 views

Does not implement methodSignatureForSelector and unrecognized selector when using Timer

Here I have a simple class that prints "test" several times a second: import Foundation class TestClass { static var count = 0 static var timer = Timer() init() { TestClass....
0
votes
1answer
138 views

Xamarin iOS: Starting timer crashes app with no exception

I'm developing a Xamarin Forms app for which I needed to write some code native, I got the code working in Android, but I can't get it to work for iOS. In Main.cs I start a scheduled timer with ...
1
vote
2answers
123 views

Adding Timers to Update UIView Background Color

Hi my fellow programmers, I'm new here and needing some help on updating UIView background with timers. Is it possible to have timers set within a specific hour range? I'm wanting to be able to have ...
1
vote
1answer
97 views

Testing timer which calls function in swift

The method someFunc() is called after the brackets. I need it to be called right after the sleep method (exactly after the time passes). It seems that the timer calls the execution block after the ...
1
vote
1answer
36 views

How to Implement separate Minute and Second Labels for a Countdown Timer

Okay, so I am working on a countdown timer function as part of an app I am working on. I have run into a bit of an issue in how to implement the timer and how it appears on screen. My two issues are, ...
3
votes
1answer
322 views

Unhandled Exception: Foundation.MonoTouchException: <Timeout exceeded getting exception details> occurred

I'm using Xamarin Forms and am seeing this problem only on an iPad Mini 1st generation (iOS 9.3.3 (13G34)). The app starts up fine, clicking stuff works fine. The only problem happens when I "tap and ...
0
votes
2answers
59 views

App crashes after the timer Instead of re-enabling button

I am new to XCode so any help will be appreciated. On button press, the button should be disabled and should display a random number and trigger a timer. Once the timer is is done then the button is ...
1
vote
1answer
43 views

Timer count throughout the game in Objective c

I am creating a game application in which I need to set timer of 2 minutes throughout the app screens in objective c. I am creating it in viewDidLoad but it is creating a new instance every-time the ...
0
votes
1answer
122 views

Trying to reuse a timer for cellForRowAtIndexPath

So my goal is to re-use a timer for every cell. Every thing is working fine except one fine point. The cell.indexpath.row start at 1 instead of 0. And even when I scroll to the top, and it bounces ...
0
votes
1answer
41 views

timer pause button reseting when press start again

So I have a program which is a stopwatch and I have the stopwatch is working but when I press the pause button the thing pauses but when I press the start button again to start the stopwatch from ...
-2
votes
1answer
45 views

IOS/Objective-C: NSTimer without handler possible in objective-C?

I am trying to translate some Swift that uses at Timer to type out words for a news ticker effect into Objective -C. In Swift, you can do something like: func type(string: String) { var ...
2
votes
2answers
62 views

Why can not I stop a timer in dispatch_async serial queue?

It's simply an experimental code, but I got confused since the code didn't execute as I supposed. The code is like: - (void)viewDidLoad { [super viewDidLoad]; self.myQueue = ...
0
votes
1answer
72 views

Using Timer To Schedule Notifications Triggering

I am trying to schedule a Timer to fire at a specific date and time, based on what the user selects in UIDatePicker. When the Timer fires, I want to set up a repeating notification (...
0
votes
0answers
35 views

NSTimer slowing down and pausing when minimized [duplicate]

I've searched endlessly for this answer and am surprised I haven't found anything (yet). What I have is an app with a super simple timer function; start the clock timer, and seconds start to click up....
0
votes
2answers
24 views

How to have a delay in seconds on timer app?

I am attempting to create a time app that is for the time that is a little off, such as I want a second in the app that is actually 1.5 seconds in real time. Currently, I am running into errors on ...