I have received a crash report from one user who cannot use the login feature of my OS X app. From reading the backtrace, the problem appears to be that [[NSHost currentHost] localizedName]
is returning nil
(I am then inserting it into an NSDictionary
, causing the app to crash).
From Apple's documentation, -localizedName
returns nil
when sent to NSHost
instances other than +currentHost
, but should return an NSString
when sent to +currentHost
.
I can get around this by checking for nil
and setting the hostname to some arbitrary string, but I would rather use the proper localised name for the computer. In what cases can the computer hostname be nil
?