calling #*06# tells the IMEI ( International Mobile Equipment Identity ) of the device.
I checked International Numbering Plans and found out that this actually is the IMEI number.
Is it possible to obtain it programmatically?
Thanks
You cannot get device IMEI programmatically. However UIDevice class has "unique device identifier" property.
#property(nonatomic, readonly, retain) NSString *uniqueIdentifier
A unique device identifier is a hash value composed from various hardware identifiers such as the device’s serial number. It is guaranteed to be unique for every device but cannot publically be tied to a user account. You can use it, for example, to store high scores for a game in a central server or to control access to registered products. The unique device identifier is sometimes referred to by its abbreviation UDID.
Related
I need to get iPhone unique number programmatically. I know that apple will reject app if I try to gain iPhone serial number.
But may be there is a way to get any unique number of iPhone, so server can distinguish one device from another.
For each iPhone, MAC address is unique ( except for iOS Simulator ). You can obtain the information to identify the device. This question will guide you to get MAC address. However, iOS7 disallows use of MAC address. Therefore, for iOS 6 or before, you can use MAC address; for the coming iOS 7, you can use the following method.
Since iOS 6, Apple suggests to use Advertising Identifier, which can be found in ASIdentifierManager class. Example code:
NSUUID *uuid = [ASIdentifierManager advertisingIdentifier];
Have you looked at identifierForVendor?
https://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/identifierForVendor
Apple describe it as:
An alphanumeric string that uniquely identifies a device to the app’s
vendor.
You should try this to get uid of your iPhone:
NSString *udid = [[UIDevice currentDevice] uniqueIdentifier];
My app has a feature which requires identifying each app users. I'm planning making the app sends UDID to my server. Server stores it, for later use.
I don't think that's a personal information, however, I want to know is it approvable or not in Apple's AppStore.
And, including transferring phone numbers. In the case of WhatsApp, it recognizes my friends' numbers automatically. I think that's impossible without some kind of data transfer.
You are allowed to transfer a device's UDID to your servers. That's what it's intended for.
Access to the UDID is grounds for rejection from the App Store. See an alternative to using the UDID at https://stackoverflow.com/a/10037636/1286639
Just make sure that it is no secret what your app does. If it transfers phone numbers to store those on your server then clearly mention this in the app's description or even ask the user for permission the first time.
That actually is a a reason to be rejected I think: not being clear about storing user's data on your own server/service.
Its important to note the difference between a UDID and a UUID.
UDID "unique device id" is hardware specific. It never changes for a particular device. For this reason, it has become a privacy concern and Apple is blocking apps that try to use this. As a result, Apple has generated an opt-out-able "device id" hash, particularly for advertisement usage. This new ID hash is called IFA and is available in iOS 6.0+.
UUID "universally unique id" is not hardware specific. It is a hash used to identify a device; but not particularly an absolute value. For example, PhoneGap generates a UUID based on device properties; this is what you get when you do device.uuid. If you delete the app and reinstall, you will get a new id hash. UUID is not being blocked by Apple.
I think the best solution in your case would be to use the IFA, with OpenUDID as a backup for iOS < 6.0.
Here is the code we use. If IFA is not available, get OpenUDID. [[You must install OpenUDID, read more about that here, https://github.com/ylechelle/OpenUDID.]]
NSString* uuid = nil;
if ([[UIDevice currentDevice] respondsToSelector:#selector(identifierForVendor)]) {
// IOS 6 new Unique Identifier implementation, IFA
uuid = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
} else {
// Before iOS6 (or if IFA disabled) you shoud use a custom implementation for uuid
// Here I use OpenUDID (you have to import it into your project)
// https://github.com/ylechelle/OpenUDID
NSString* openUDID = [OpenUDID value];
uuid = [OpenUDID value];
}
There was a hack for previous firmware using a reverse engineering of Code Telephony but it does not work anymore.
As far as I know, you can only get the UDID on the iphone.
[UIDevice currentDevice].uniqueIdentifier
A unique device identifier is a hash value composed from various hardware identifiers such as the device’s serial number. It is guaranteed to be unique for every device but cannot publically be tied to a user account. You can use it, for example, to store high scores for a game in a central server or to control access to registered products. The unique device identifier is sometimes referred to by its abbreviation UDID.
Is there a unique ID like the mac address for each iPhone / iPod Touch?
Do I have to ask the user for permissions to transmit such a unique id?
Yes, you can get it using UIDevice's uniqueIdentifier property:
A unique device identifier is a hash value composed from various hardware identifiers such as the device’s serial number. It is guaranteed to be unique for every device but cannot publically be tied to a user account. You can use it, for example, to store high scores for a game in a central server or to control access to registered products. The unique device identifier is sometimes referred to by its abbreviation UDID.
Edit: uniqueIdentifier property is deprecated in iOS5 and you should not use it now. As an alternative you can generate your own unique ID (for example check this questions).
Also in iOS6 Apple added 2 new methods to get unique identifier (as an instance of NSUUID class):
UIDevice -identifierForVendor:
The value of this property is the same for apps that come from the
same vendor running on the same device. A different value is returned
for apps onthe same device that come from different vendors, and for
apps on different devices regardles of vendor.
ASIdentifierManager -advertisingIdentifier:
Unlike the identifierForVendor property of the UIDevice, the same
value is returned to all vendors. This identifier may change—for
example, if the user erases the device—so you should not cache it.
Two part question:
Does the iPhone have a unique ID other than it's MAC address?
If so, is there an API call I can use to get it?
(hopefully this isn't a duplicate, I couldn't find anything on SO)
The iPhone does have a unique identifier, called the UDID (this is the same identifier used when setting up a device for development or when doing ad hoc distribution). You can retrieve it as so:
NSString *uniqueIdentifier = [UIDevice currentDevice].uniqueIdentifier;