How to get the Device ID from an iOS app?
I think this code may help you ;)
NSString * id = [UIDevice currentDevice].uniqueIdentifier;
You can also have a look to http://developer.apple.com/library/ios/#documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html
use this
UIDevice *device = [UIDevice currentDevice];
NSString *uniqueIdentifier = [device uniqueIdentifier];
Update
Apple has the deprecated unique identifier, so now the following code (from Melvin Sovereign's comment) is appropriate:
NSString *uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
Interestingly, Apple has since deprecated the uniqueIdentifier in iOS 5. Here's the relevant TechCrunch article: http://techcrunch.com/2011/08/19/apple-ios-5-phasing-out-udid/
Apple suggests that you no longer uniquely identify the device but instead identify the user. In most cases, this is excellent advice though there are some situations which still require a globally unique device ID. These scenarios are quite common in advertising. Hence, I wrote an extremely simple drop-in library which replicates the existing behavior exactly.
In a shameless plug of self promotion, I'll link it here in the hope that someone finds it useful. Also, I welcome all and any feedback/criticism: http://www.binpress.com/app/myid/591