1. Get information about your device
Uidevice *device = [[Uidevice alloc] init];
NSString *name = device.name; Get the name of the device owner
NSString *model = device.name; Get the category of the device
NSString *type = Device.localizedmodel; Get localized version
NSString *systemname = device.systemname; Get the currently running system
NSString *systemversion = device.systemversion;//Gets the version of the current system
NSLog (@ "name:%@\nmodel:%@\ntype:%@\nsystemname:%@\nsystemversion:%@\n", Name,model,type,systemname, Systemversion);
2. Get unique identifiers for the device
NSString *identifier = [[[Uidevice Currentdevice] Identifierforvendor] uuidstring];
NSLog (@ "identifier:%@", identifier);
3. Create a UUID (a random identifier)
NSString *uuid = [self createuuid];
NSLog (@ "uuid:%@", uuid);
-(nsstring*) Createuuid {
NSString *id = [[Nsuserdefaults standarduserdefaults] objectforkey:@ "UUID"]; Gets the value identified as "UUID"
if (id = = nil)
{
if ([[[Uidevice Currentdevice] systemversion] Floatvalue] > 6.0)
{
APIs that can be used after iOS 6.0
NSString *identifiernumber = [[Nsuuid UUID] uuidstring];
[[Nsuserdefaults Standarduserdefaults] setobject:identifiernumber forkey:@ "UUID"];
[[Nsuserdefaults standarduserdefaults] synchronize];
}
else{
APIs used prior to ios6.0
Cfuuidref uuid = cfuuidcreate (NULL);
Cfstringref uuidstring = cfuuidcreatestring (NULL, UUID);
NSString *identifiernumber = [NSString stringwithformat:@ "%@", uuidstring];
[[Nsuserdefaults Standarduserdefaults] setobject:identifiernumber forkey:@ "UUID"];
[[Nsuserdefaults standarduserdefaults] synchronize];
Cfrelease (uuidstring);
Cfrelease (UUID);
}
return [[Nsuserdefaults standarduserdefaults] objectforkey:@ "UUID"];
}
return ID;
}
iOS Development--Summary of device information (not yet finished ...) )