NSAppleEventDescriptor lacks essential functionality

Originator:automate.mantasystems
Number:rdar://19169736 Date Originated:07-Dec-2014 02:20 PM
Status:Closed Resolved:Fixed in 10.11
Product:OS X Product Version:10.10
Classification:Enhancement Reproducible:
 
NSAppleEventDescriptor lacks several features essential to building and sending Apple events:

* no way to pack/unpack typeLongDateTime descriptors
* no way to pack typeProcessSerialNumber descriptors identifying the current process
* no way to check if an AEDesc is a record descriptor
* no way to send an AppleEvent.

Traditionally, developers could work around these omissions by using the original Carbon APIs, but as these APIs are now officially legacy or deprecated status, they are not a trustworthy foundation for new product development.

The attached patch contains five additional methods that address the above deficiencies:

+descriptorWithDate:
+currentProcessDescriptor
-isRecordDescriptor
-dateValue
-sendAppleEventWithMode:timeouterror:error:

While the patch has been implemented as a category (NSAppleEventDescriptor+AEDescExtensions), this was done for testing purposes only. I recommend inserting these methods directly into the NSAppleEventDescriptor class.

This code is taken from my existing AppleEventBridge project (https://bitbucket.org/hhas/appleeventbridge/), originally released under the BSD/MIT License but now released into the public domain. Apple is free to incorporate these five methods into its own codebase and place its own copyright upon them.

Notes:

Note that this patch only provides modern replacements to five essential legacy/deprecated Carbon functions/types. 

It does not define alternatives to existing Apple Event Manager-defined constants as there are hundreds of those. I'd recommend Apple ensures existing AE constants are fully supported and available to Cocoa developers as part of the NSAppleEventDescriptor-related APIs and documentation.

Comments

Methods added in OS X 10.11, caveat bug (rdar://21477694)

By automate.mantasystems at June 21, 2015, 5:33 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!