Swift converts four-char codes in AE, OpenScripting frameworks to wrong type
| Originator: | automate.mantasystems | ||
| Number: | rdar://21608490 | Date Originated: | 30-Jun-2015 |
| Status: | Closed | Resolved: | 22-Jun-2016 |
| Product: | OS X SDK | Product Version: | 10.11 |
| Classification: | Bug | Reproducible: | Always |
Summary: Four-char code constants (typeBoolean, keyAETarget, etc) declared as enums in and CoreServices/AE and Carbon/OpenScripting framework headers are not explicitly typed so Swift assumes them to be Ints. This prevents their use NSAppleEventDescriptor and other APIs that require OSType/DescType/AEKeyword, i.e. UInt32. Annotating these enums with the correct type should fix this. Version: Xcode Version 7.0 beta (7A121l) Notes: It is unclear whether Apple encourage or discourage the use of these constants. While defined in legacy Carbon APIs, they are still necessary when developing new code with Cocoa APIs such as NSAppleEventDescriptor and OSAKit. It would be very helpful if some kind of clarification could be added to headers and documentation on recommended practice for 3rd-party developers.
Comments
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!
Turns out there are still some AE constants that are bridged to wrong Swift type, but eh... life's too short.