Return iPhone owners name
Submitted by drunknbass on December 2, 2007 - 12:30pm.
remember arrays start at 0 so thats how objectAtIndex returns the 2nd value in the array.
You can use NSHost.
you can return name(string) or names(array)
so if you return the array of names, what mine does is return 3 values.
1. "iPhone"
2. "Aaron Alexander's iPhone"
3. "localhost"
you prob want #2, which seems to be what the name is in itunes for your iphone.

NSArray *names = [[NSHost currentHost] names];
NSString *name = [names objectAtIndex:1];
NSLog(@"OWNER: %@",name);
NSString *name = [names objectAtIndex:1];
NSLog(@"OWNER: %@",name);
or if you dont want anything else out of that array you could condense the code into

NSString *name = [[[NSHost currentHost] names] objectAtIndex:1];
Hey DrunkenBass, This code
Hey DrunkenBass,
This code cause my app to freeze for a good 10 seconds+ before displaying the info. Any ideas why the lookup takes so long?
James
Excelente, creo que esta
Excelente, creo que esta mejora, viene a darle un valor agregado al aparato, pero ¿cuando podemos descargarla?
omg dude
that is so amazing but i am school right now so i will download it when i get home....when might we expect the final version?