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 main app. The main app communicates with the helper tool via NSXPCConnection. I'm using an NSTimer to send the update messages to the delegate with the following incantation: [NSTimer timerWithTimeInterval:0.2 repeats:YES block:^(NSTimer * _Nonnull timer) { ... }]; This works fine, but I've just realised NSTimer's timerWithTimeInterval:repeats:block: is only available with macOS 10.12 and I still need to support 10.8. 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 privileged helper tool to crash with the following message printed to Console: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSXPCEncoder _checkObject:]: This coder only encodes objects that adopt NSSecureCoding (object is of class '__NSCFTimer').' 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? I guess, if push comes to shove, I could put the timer in the main app and have it request updates from the helper tool, but that sounds awfully like polling, and feels like it would be the wrong way round! Grateful for any suggestions. Many thanks Mark _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com