Re: Problem using NSTimer in privileged helper tool

2017-10-22 Thread Uli Kusterer
On 19. Oct 2017, at 18:04, Mark Allan wrote: > So I tried refactoring the block into a separate method and using an older > NSTimer method: > [NSTimer timerWithTimeInterval:0.2 target:self > selector:@selector(updateTheDelegateForRunID:) userInfo:runID repeats:YES]; > > > This causes my

Re: Problem using NSTimer in privileged helper tool

2017-10-21 Thread Jean-Daniel
> Le 20 oct. 2017 à 18:56, Quincey Morris > a écrit : > > On Oct 20, 2017, at 03:23 , Mark Allan wrote: >> >> That worked with the block-based NSTimer API but not the selector-based API. >> I tried changing it to 'currentRunLoop' which got rid of the crash, but the >> timer never fired. >

Re: Problem using NSTimer in privileged helper tool

2017-10-20 Thread Jens Alfke
> On Oct 20, 2017, at 9:56 AM, Quincey Morris > wrote: > > — When you scheduled the timer on the main run loop, it was actually being > scheduled on the main app’s run loop. When it was block based, only the block > had to be passed across the XPC interface (which somehow works), but when it

Re: Problem using NSTimer in privileged helper tool

2017-10-20 Thread Quincey Morris
On Oct 20, 2017, at 03:23 , Mark Allan wrote: > > That worked with the block-based NSTimer API but not the selector-based API. > I tried changing it to 'currentRunLoop' which got rid of the crash, but the > timer never fired. This is pure guesswork, but I suspect this is what was going on: —

Re: Problem using NSTimer in privileged helper tool

2017-10-20 Thread Mark Allan
(sending again - the list was missed off the 'cc' in my reply) > On 19 Oct 2017, at 6:19 pm, Jens Alfke > wrote: > >> On Oct 19, 2017, at 9:04 AM, Mark Allan > > wrote: >> >> Initially, I thought this meant my own class needed to conform t

Re: Problem using NSTimer in privileged helper tool

2017-10-20 Thread Mark Allan
> On 19 Oct 2017, at 6:05 pm, Quincey Morris > wrote: > > On Oct 19, 2017, at 09:04 , Mark Allan > wrote: >> >> Terminating app due to uncaught exception 'NSInvalidArgumentException', >> reason: '*** -[NSXPCEncoder _checkObject:]: This coder only encodes objects

Re: Problem using NSTimer in privileged helper tool

2017-10-19 Thread Quincey Morris
On Oct 19, 2017, at 09:04 , Mark Allan wrote: > > Terminating app due to uncaught exception 'NSInvalidArgumentException', > reason: '*** -[NSXPCEncoder _checkObject:]: This coder only encodes objects > that adopt NSSecureCoding (object is of class '__NSCFTimer').' It’s very suspicious that the

Re: Problem using NSTimer in privileged helper tool

2017-10-19 Thread Alex Zavatone
A granular timer shouldn’t be that hard to write. Can you use CFAbsoluteTimeGetCurrent() ? It’s in MacOS since 10.0. https://developer.apple.com/documentation/corefoundation/1543542-cfabsolutetimegetcurrent > On Oct 19, 2017, at 11:04 AM, Mark Allan wrote: > > Hi all, > > I'm currently wr

Problem using NSTimer in privileged helper tool

2017-10-19 Thread Mark Allan
Hi all, I'm currently writing a Mac app which performs some lengthy process on some data, and for a variety of reasons it needs to do this via privileged helper tool. The class which does the work sends progress updates periodically to its delegate, which then communicates these back to the ma