NSAppleEventDescriptor lacks convenience features

Originator:automate.mantasystems
Number:rdar://19169791 Date Originated:07-Dec-2014 03:09 PM
Status:Closed Resolved:Fixed in 10.11
Product:OS X Product Version:10.10
Classification:Enhancement Reproducible:
 
NSAppleEventDescriptor currently provides methods for packing and unpacking most - but not all - commonly used descriptorTypes. The attached patch contains six additional convenience methods:

+descriptorWithDouble:
+descriptorWithFileURL:
+descriptorWithProcessID:
+descriptorWithApplicationURL:
-doubleValue
-fileURLValue

These methods are not essential as all of these values can be packed and unpacked as raw bytes using NSAppleEventDescriptor's -descriptorWithDescriptorType: bytes:length: and -data methods. However, adding these methods to NSAppleEventDescriptor would make the process much less painful and error prone.

(To minimize patch size, -processIDValue and -applicationURLValue are not included. Descriptors of these types are frequently used in +appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID: to identify the target process, but are rarely used elsewhere so there is little need to unpack them again.)

While the patch has been implemented as a category (NSAppleEventDescriptor+AEDescMoreExtensions), 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 six methods into its own codebase and place its own copyright upon them.

Comments

Methods added in OS X 10.11

By automate.mantasystems at June 21, 2015, 5:29 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!