Re: Problem using NSTimer in privileged helper tool
Re: Problem using NSTimer in privileged helper tool
- Subject: Re: Problem using NSTimer in privileged helper tool
- From: Mark Allan <email@hidden>
- Date: Fri, 20 Oct 2017 11:27:08 +0100
(sending again - the list was missed off the 'cc' in my reply)
> On 19 Oct 2017, at 6:19 pm, Jens Alfke <email@hidden
> <mailto:email@hidden>> wrote:
>
>> On Oct 19, 2017, at 9:04 AM, Mark Allan <email@hidden
>> <mailto:email@hidden>> wrote:
>>
>> Initially, I thought this meant my own class needed to conform to
>> NSSecureCoding, but after some failed attempts, it think it's trying to tell
>> me that it can't do it because *NSTimer* doesn't conform to NSSecureCoding.
>> Is that correct, and if so does anyone know of a way around this issue?
>
> You’re probably not intentionally trying to send the NSTimer object across
> the XPC connection, but it seems to be happening by accident. The backtrace
> of the exception should indicate what remote method you’re calling that
> includes the timer in a parameter.
Thanks for the suggestion. Even though I've now got a working solution, this
intrigued me enough to try and find out where I might be inadvertently sending
an NSTimer across the XPC connection. Console in macOS 10.12 only shows a
handful of lines of the backtrace so I had to implement my own logging to catch
this!
I've checked the backtrace and there's only two methods listed - the one which
the timer fires and the one in the delegate which communicates back to the main
app. The only parameters involved are NSNumber and NSString, and the delegate
method has a single line which simply passes those parameters back to the main
app via the remote object proxy.
Thinking about it some more, if the NSTimer were being sent across the XPC
connection, surely that would also have been happening with the newer
block-based NSTimer API I was using originally?
I think that means it *must* be something related to the run-loop, as Quincey
suggests, but I'm still not sure what the issue is.
I've got a working solution now, so unless anyone wants me to do a bit more
digging or testing anything, I'll leave it at that.
Thanks for all the help.
Mark
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden