{
"$type": "site.standard.document",
"description": "Ever since I started coding in Cocoa, I’ve been wondering what might be the longest name used for any function or constant in the entire API. Cocoa names can get quite long in general, so the longest one should be really ridiculously long… Of course I couldn’t leave it like this and I had to find out what it was :)\n\nI ran a search for *.h files on the whole disk, and I determined that the interesting stuff was either in /Developer or in /System/Library/Frameworks, so I limited the search to these directories only. I passed the list of all header files through a Ruby script that looked for the really long ones and sorted them by length, and then I analyzed the results to find the winners (I decided to divide them into a few categories).\n\nSo here’s what I’ve found:\nThe longest name in the whole result set\n\ncairo_atsui_font_face_create_for_atsu_font_id_REPLACED_BY_cairo_quartz_font_face_create_for_atsu_font_id (104)\n\nThis monstrosity was found in cairo-deprecated.h in X11 headers directory. Doesn’t really count as Cocoa though, it wasn’t even written by Apple (it says RedHat in the comments).\n\nThe longest names in Apple’s frameworks:\n\nkBluetoothAMPManagerCreatePhysicalLinkResponseAMPDisconnectedPhysicalLinkRequestReceived (88)\nkBluetoothHCIExtendedInquiryResponseDataType128BitServiceClassUUIDsWithMoreAvailable (84)\n\nThese were both found inside IOBluetooth.framework. Note to self: don’t try to code anything Bluetooth-related in Cocoa…\n\nPopularity award:\n\n__AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 (83)\n\nThis award goes to this interesting macro and all its relatives, of which there are many (basically all possible combinations of existing MacOSX versions). These things are just *everywhere*… For the rest of the categories I’m going to ignore these, to make the results more interesting.\n\nThe longest names in Cocoa:\n\nIt’s hard to tell what exactly counts as Cocoa and what doesn’t, I’ve always thought of Cocoa as a broad term including all of Apple’s MacOSX frameworks. However, if you import <Cocoa/Cocoa.h> in your code, it only includes Foundation, AppKit and CoreData, so I guess technically only these three form the core Cocoa framework.\n\nHere are the winners in this category:\n\nNSAccessibilityLayoutPointForScreenPointParameterizedAttribute (62)\nNSAccessibilityScreenPointForLayoutPointParameterizedAttribute (62)\nNSAttributedStringEnumerationLongestEffectiveRangeNotRequired (61)\n\nThe first two are from NSAccessibility (AppKit), the third one from NSAttributedString (Foundation).\n\nThe longest names in UIKit:\n\ndelegateTitleForDeleteConfirmationButtonForRowAtIndexPath (57)\n\nThis one is defined in the header for UITableView, but it doesn’t appear in any official documentation, so it probably shouldn’t count.\n\nwillAnimateSecondHalfOfRotationFromInterfaceOrientation (55)\nUIApplicationWillChangeStatusBarOrientationNotification (55)\n\nThese two come from UIViewController and UIApplication, and they do appear in the docs.…",
"path": "/2010/10/31/the-longest-names-in-cocoa/",
"publishedAt": "2010-10-31T15:52:04Z",
"site": "at://did:plc:oio4hkxaop4ao4wz2pp3f4cr/site.standard.publication/3mn5mackuba26",
"tags": [
"Cocoa",
"iPhone"
],
"textContent": "Ever since I started coding in Cocoa, I’ve been wondering what might be the longest name used for any function or constant in the entire API. Cocoa names can get quite long in general, so the longest one should be really ridiculously long… Of course I couldn’t leave it like this and I had to find out what it was :)\n\nI ran a search for *.h files on the whole disk, and I determined that the interesting stuff was either in /Developer or in /System/Library/Frameworks, so I limited the search to these directories only. I passed the list of all header files through a Ruby script that looked for the really long ones and sorted them by length, and then I analyzed the results to find the winners (I decided to divide them into a few categories).\n\nSo here’s what I’ve found:\nThe longest name in the whole result set\n\ncairo_atsui_font_face_create_for_atsu_font_id_REPLACED_BY_cairo_quartz_font_face_create_for_atsu_font_id (104)\n\nThis monstrosity was found in cairo-deprecated.h in X11 headers directory. Doesn’t really count as Cocoa though, it wasn’t even written by Apple (it says RedHat in the comments).\n\nThe longest names in Apple’s frameworks:\n\nkBluetoothAMPManagerCreatePhysicalLinkResponseAMPDisconnectedPhysicalLinkRequestReceived (88)\nkBluetoothHCIExtendedInquiryResponseDataType128BitServiceClassUUIDsWithMoreAvailable (84)\n\nThese were both found inside IOBluetooth.framework. Note to self: don’t try to code anything Bluetooth-related in Cocoa…\n\nPopularity award:\n\n__AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 (83)\n\nThis award goes to this interesting macro and all its relatives, of which there are many (basically all possible combinations of existing MacOSX versions). These things are just *everywhere*… For the rest of the categories I’m going to ignore these, to make the results more interesting.\n\nThe longest names in Cocoa:\n\nIt’s hard to tell what exactly counts as Cocoa and what doesn’t, I’ve always thought of Cocoa as a broad term including all of Apple’s MacOSX frameworks. However, if you import <Cocoa/Cocoa.h> in your code, it only includes Foundation, AppKit and CoreData, so I guess technically only these three form the core Cocoa framework.\n\nHere are the winners in this category:\n\nNSAccessibilityLayoutPointForScreenPointParameterizedAttribute (62)\nNSAccessibilityScreenPointForLayoutPointParameterizedAttribute (62)\nNSAttributedStringEnumerationLongestEffectiveRangeNotRequired (61)\n\nThe first two are from NSAccessibility (AppKit), the third one from NSAttributedString (Foundation).\n\nThe longest names in UIKit:\n\ndelegateTitleForDeleteConfirmationButtonForRowAtIndexPath (57)\n\nThis one is defined in the header for UITableView, but it doesn’t appear in any official documentation, so it probably shouldn’t count.\n\nwillAnimateSecondHalfOfRotationFromInterfaceOrientation (55)\nUIApplicationWillChangeStatusBarOrientationNotification (55)\n\nThese two come from UIViewController and UIApplication, and they do appear in the docs.\n\nThe longest notification name:\n\nQTCaptureConnectionFormatDescriptionWillChangeNotification (58)\nMPMusicPlayerControllerNowPlayingItemDidChangeNotification (58)\n\nNotification names tend to be very long in general, so I thought they deserved their own category. These two come from QTKit and iPhone’s MediaPlayer framework. These two frameworks (and media-related frameworks in general) had a lot of crazy entries in the result list, so I guess they must be not too fun to use…\n\nAnd the longest notification in Cocoa (AppKit) was this one (from NSTextInputContext.h):\n\nNSTextInputContextKeyboardSelectionDidChangeNotification (56)\n\nSo, mystery solved :) Now I can happily go back to Cocoa coding, looking at the names in my code, and knowing it’s not the worst that could have happened…",
"title": "The longest names in Cocoa",
"updatedAt": "2025-06-30T01:49:16Z"
}