I'm using the follow doc -https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSLocale_Class/index.html#//apple_ref/occ/clm/NSLocale/localeIdentifierFromComponents:
Find localeIdentifierFromComponents(_:)
if the link doesn't jump to the correct section of the page.
XCode 7.2 playground
print(NSLocale.localeIdentifierFromComponents([
NSLocaleLanguageCode:"en",
NSLocaleCountryCode:"US",
NSLocaleCalendar: NSJapaneseCalendar
]))
//EXC_BAD_ACCESS
whereas
print(NSLocale.localeIdentifierFromComponents([
NSLocaleLanguageCode:"en",
NSLocaleCountryCode:"US",
]))
//"en_US"
If I use the inverse operation
print(NSLocale.componentsFromLocaleIdentifier("en_US@calendar=japanese"))
//["kCFLocaleCountryCodeKey": "US", "kCFLocaleLanguageCodeKey": "en", "calendar": "japanese"]
NSLocaleCalendar maps to kCFLocaleCalendarKey, not "calendar"
So am I doing something wrong or are the docs just wrong?