Is this correct for a NSTimer to get run on the main thread?swift NSTimer in BackgroundRun timer in 'background' when app is closedHow to run timer thought the app entered background or is terminatedHow do I use NSTimer?viewDidUnload - stopping a method when the view is changedEXC_BAD_ACCESS - NSZombie catches nothing but NSEnableAutoReleasePool=NO fixesiOS5 ARC is it safe to schedule NSTimers from background selectors?iPhone 4 is there an absolutely certain way to have a long term NSTimer fireNSTimer, Threads. How to create a threaded NSTimer?Continuous UI activity and frequent NSTimer callsupdate label after every X seconds in cooca mac applicationUISlider thumb not moving as label value changes in ios objective-cRun closure on main thread

How can I make my BBEG immortal short of making them a Lich or Vampire?

Show that if two triangles built on parallel lines, with equal bases have the same perimeter only if they are congruent.

Why do I get two different answers for this counting problem?

Did Shadowfax go to Valinor?

Why are 150k or 200k jobs considered good when there are 300k+ births a month?

What would happen to a modern skyscraper if it rains micro blackholes?

Can I ask the recruiters in my resume to put the reason why I am rejected?

How does one intimidate enemies without having the capacity for violence?

What defenses are there against being summoned by the Gate spell?

Maximum likelihood parameters deviate from posterior distributions

The use of multiple foreign keys on same column in SQL Server

Why, historically, did Gödel think CH was false?

Arthur Somervell: 1000 Exercises - Meaning of this notation

Why not use SQL instead of GraphQL?

Do I have a twin with permutated remainders?

Font hinting is lost in Chrome-like browsers (for some languages )

Why was the small council so happy for Tyrion to become the Master of Coin?

can i play a electric guitar through a bass amp?

Fencing style for blades that can attack from a distance

How much RAM could one put in a typical 80386 setup?

If I cast Expeditious Retreat, can I Dash as a bonus action on the same turn?

Writing rule stating superpower from different root cause is bad writing

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine



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


swift NSTimer in BackgroundRun timer in 'background' when app is closedHow to run timer thought the app entered background or is terminatedHow do I use NSTimer?viewDidUnload - stopping a method when the view is changedEXC_BAD_ACCESS - NSZombie catches nothing but NSEnableAutoReleasePool=NO fixesiOS5 ARC is it safe to schedule NSTimers from background selectors?iPhone 4 is there an absolutely certain way to have a long term NSTimer fireNSTimer, Threads. How to create a threaded NSTimer?Continuous UI activity and frequent NSTimer callsupdate label after every X seconds in cooca mac applicationUISlider thumb not moving as label value changes in ios objective-cRun closure on main thread






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















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 RootViewController : UIViewController 

NSTimer *minutePassed;


- (void)adViewDidLoad


minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutedPassed) userInfo:nil repeats:NO];



-(void)callMinutePassed

NSLog("Minute Passed");










share|improve this question



















  • 1





    This is the right way to schedule a timer. A few unrelated observations: gist.github.com/robertmryan/e8ec70f49f0c112ffdd7c4566eedc13e

    – Rob
    Mar 22 at 1:05











  • if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

    – izzy Machado
    Mar 25 at 19:25











  • See stackoverflow.com/a/31642036/1271826 or stackoverflow.com/a/26405492/1271826 or stackoverflow.com/a/34497360/1271826...

    – Rob
    Mar 25 at 19:42

















0















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 RootViewController : UIViewController 

NSTimer *minutePassed;


- (void)adViewDidLoad


minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutedPassed) userInfo:nil repeats:NO];



-(void)callMinutePassed

NSLog("Minute Passed");










share|improve this question



















  • 1





    This is the right way to schedule a timer. A few unrelated observations: gist.github.com/robertmryan/e8ec70f49f0c112ffdd7c4566eedc13e

    – Rob
    Mar 22 at 1:05











  • if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

    – izzy Machado
    Mar 25 at 19:25











  • See stackoverflow.com/a/31642036/1271826 or stackoverflow.com/a/26405492/1271826 or stackoverflow.com/a/34497360/1271826...

    – Rob
    Mar 25 at 19:42













0












0








0


0






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 RootViewController : UIViewController 

NSTimer *minutePassed;


- (void)adViewDidLoad


minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutedPassed) userInfo:nil repeats:NO];



-(void)callMinutePassed

NSLog("Minute Passed");










share|improve this question
















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 RootViewController : UIViewController 

NSTimer *minutePassed;


- (void)adViewDidLoad


minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutedPassed) userInfo:nil repeats:NO];



-(void)callMinutePassed

NSLog("Minute Passed");







ios objective-c nstimer






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 1:05









Rob

307k51579748




307k51579748










asked Mar 21 at 23:51









izzy Machadoizzy Machado

1391113




1391113







  • 1





    This is the right way to schedule a timer. A few unrelated observations: gist.github.com/robertmryan/e8ec70f49f0c112ffdd7c4566eedc13e

    – Rob
    Mar 22 at 1:05











  • if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

    – izzy Machado
    Mar 25 at 19:25











  • See stackoverflow.com/a/31642036/1271826 or stackoverflow.com/a/26405492/1271826 or stackoverflow.com/a/34497360/1271826...

    – Rob
    Mar 25 at 19:42












  • 1





    This is the right way to schedule a timer. A few unrelated observations: gist.github.com/robertmryan/e8ec70f49f0c112ffdd7c4566eedc13e

    – Rob
    Mar 22 at 1:05











  • if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

    – izzy Machado
    Mar 25 at 19:25











  • See stackoverflow.com/a/31642036/1271826 or stackoverflow.com/a/26405492/1271826 or stackoverflow.com/a/34497360/1271826...

    – Rob
    Mar 25 at 19:42







1




1





This is the right way to schedule a timer. A few unrelated observations: gist.github.com/robertmryan/e8ec70f49f0c112ffdd7c4566eedc13e

– Rob
Mar 22 at 1:05





This is the right way to schedule a timer. A few unrelated observations: gist.github.com/robertmryan/e8ec70f49f0c112ffdd7c4566eedc13e

– Rob
Mar 22 at 1:05













if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

– izzy Machado
Mar 25 at 19:25





if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

– izzy Machado
Mar 25 at 19:25













See stackoverflow.com/a/31642036/1271826 or stackoverflow.com/a/26405492/1271826 or stackoverflow.com/a/34497360/1271826...

– Rob
Mar 25 at 19:42





See stackoverflow.com/a/31642036/1271826 or stackoverflow.com/a/26405492/1271826 or stackoverflow.com/a/34497360/1271826...

– Rob
Mar 25 at 19:42












1 Answer
1






active

oldest

votes


















1














Documentation for scheduledTimer(timeInterval:target:selector:userInfo:repeats) states Creates a timer and schedules it on the current run loop in the default mode.. That means in your instance, that it is running on the main thread. I'm assuming when you say -(void)adViewDidLoad you mean -(void)viewDidLoad().






share|improve this answer























  • correct, thanks for the correction

    – izzy Machado
    Mar 22 at 0:07











  • if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

    – izzy Machado
    Mar 25 at 19:24












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290891%2fis-this-correct-for-a-nstimer-to-get-run-on-the-main-thread%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Documentation for scheduledTimer(timeInterval:target:selector:userInfo:repeats) states Creates a timer and schedules it on the current run loop in the default mode.. That means in your instance, that it is running on the main thread. I'm assuming when you say -(void)adViewDidLoad you mean -(void)viewDidLoad().






share|improve this answer























  • correct, thanks for the correction

    – izzy Machado
    Mar 22 at 0:07











  • if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

    – izzy Machado
    Mar 25 at 19:24
















1














Documentation for scheduledTimer(timeInterval:target:selector:userInfo:repeats) states Creates a timer and schedules it on the current run loop in the default mode.. That means in your instance, that it is running on the main thread. I'm assuming when you say -(void)adViewDidLoad you mean -(void)viewDidLoad().






share|improve this answer























  • correct, thanks for the correction

    – izzy Machado
    Mar 22 at 0:07











  • if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

    – izzy Machado
    Mar 25 at 19:24














1












1








1







Documentation for scheduledTimer(timeInterval:target:selector:userInfo:repeats) states Creates a timer and schedules it on the current run loop in the default mode.. That means in your instance, that it is running on the main thread. I'm assuming when you say -(void)adViewDidLoad you mean -(void)viewDidLoad().






share|improve this answer













Documentation for scheduledTimer(timeInterval:target:selector:userInfo:repeats) states Creates a timer and schedules it on the current run loop in the default mode.. That means in your instance, that it is running on the main thread. I'm assuming when you say -(void)adViewDidLoad you mean -(void)viewDidLoad().







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 22 at 0:02









TimTwoToesTimTwoToes

325210




325210












  • correct, thanks for the correction

    – izzy Machado
    Mar 22 at 0:07











  • if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

    – izzy Machado
    Mar 25 at 19:24


















  • correct, thanks for the correction

    – izzy Machado
    Mar 22 at 0:07











  • if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

    – izzy Machado
    Mar 25 at 19:24

















correct, thanks for the correction

– izzy Machado
Mar 22 at 0:07





correct, thanks for the correction

– izzy Machado
Mar 22 at 0:07













if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

– izzy Machado
Mar 25 at 19:24






if i have something like this and the app goes into background does the countdown keep counting to 60 seconds or does it get paused ?, minutePassed = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(callMinutePassed) userInfo:nil repeats:NO];

– izzy Machado
Mar 25 at 19:24




















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290891%2fis-this-correct-for-a-nstimer-to-get-run-on-the-main-thread%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript