Iphone – Unique identifier for an iPhone app

ios-simulatoriphone

For an iPhone app that submits images to a server I need somehow to tie all the images from a particular phone together. With every submit I'd like to send some unique phone id. Looked at

  [[UIDevice mainDevice] uniqueIdentifier]
and [[NSUserDefaults standardDefaults] stringForKey:@"SBFormattedPhoneNumber"]

but getting errors in the simulator.

Is there an Apple sanctioned way of doing this?

Best Solution

What errors are you getting? [[UIDevice currentDevice] uniqueIdentifier] (edited to fix API, thanks Martin!) is the officially recommended way of doing this.