How can i get the computer's name in objective-c on a mac. I'm talking about the same name as the one you can find in System Profiler under software.
+2
A:
NSHost is what you want here:
NSHost *host;
host = [NSHost currentHost];
[host name];
ennuikiller
2010-10-31 13:09:29
Will that get be the user friendly name (so including things like spaces and apostrophes), or the dumber version where spaces are replaced with - and ' removed.
Jonathan
2010-10-31 17:39:24
From the linked doc: `Can be either a simple hostname, such as @"sales", or a fully qualified domain name, such as @"sales.anycorp.com".`
invariant
2010-10-31 23:05:03