Original address: http://www.knowsky.com/884470.html
IDFV: The full name Identifierforvendor, in the literal sense, the same vendor should have the same identifier. Vendor is defined by the first two of the app's Bundleid, such as the 2 Bundleid apps for Com.abc.app1 and Com.abc.app2, and they belong to the same vendor. IDFV is sure to get it. One thing to note is that when the user unloads all the apps under a vendor, the IDFV is reset, and when it's installed again, the IDFV gets to be different. So the plan I'm using is: Idfv+keychain. Of course, if the user chooses to restore the factory settings, then there will be a different, this situation can not be processed.
+ (NSString *) identifier{ nsstring *key = @ "Com.app.keychain.uuid"; Keychainitemwrapper *keychainitem = [[Keychainitemwrapper alloc] Initwithidentifier:key Accessgroup:nil]; NSString *struuid = [Keychainitem objectforkey: (__bridge ID) ksecvaluedata]; if (struuid.length <= 0) { struuid = [[[Uidevice Currentdevice] Identifierforvendor] uuidstring]; [Keychainitem setobject:@ "UUID" Forkey: (__bridge ID) ksecattraccount]; [Keychainitem setobject:struuid Forkey: (__bridge ID) ksecvaluedata]; } return struuid;}
Phone aliases
+ (NSString *) phonename{ return [[Uidevice Currentdevice] name];}
Mobile phone system version
/** * Mobile System version * * @return e.g. 8.0 */+ (NSString *) phoneversion{ return [[Uidevice Currentdevice] Systemversion];}
Phone model
This method only obtains the iphone, the ipad this kind of information, cannot obtain to is the iphone 4, iphpone5 this specific model.
/** * Phone model * * @return e.g. IPhone */+ (NSString *) phonemodel{ return [[Uidevice Currentdevice] model];}
Device version
This code can be obtained to the specific device version (has been updated to the iphone 6s, iphone 6s Plus), the disadvantage is: the use of hard-coded. The specific correspondence can be consulted: https://www.theiphonewiki.com/wiki/Models
This method can pass AppStore audit, rest assured use it.
/** * Device Version * * @return e.g. IPhone 5S */+ (nsstring*) deviceversion{//Requires #import "sys/utsname.h" struct Utsname sy Steminfo; Uname (&systeminfo); NSString *devicestring = [NSString stringWithCString:systemInfo.machine encoding:nsutf8stringencoding]; iphone if ([devicestring isequaltostring:@ "iphone1,1"]) return @ "iphone 1G"; if ([devicestring isequaltostring:@ "iphone1,2"]) return @ "IPhone 3G"; if ([devicestring isequaltostring:@ "iphone2,1"]) return @ "IPhone 3GS"; if ([devicestring isequaltostring:@ "iphone3,1"]) return @ "IPhone 4"; if ([devicestring isequaltostring:@ "iphone3,2"]) return @ "Verizon IPhone 4"; if ([devicestring isequaltostring:@ "iphone4,1"]) return @ "IPhone 4S"; if ([devicestring isequaltostring:@ "iphone5,1"]) return @ "IPhone 5"; if ([devicestring isequaltostring:@ "iphone5,2"]) return @ "IPhone 5"; if ([devicestring isequaltostring:@ "iphone5,3"]) return @ "IPhone 5C"; if ([Devicestring Isequaltostring:@ "iphone5,4") return @ "IPhone 5C"; if ([devicestring isequaltostring:@ "iphone6,1"]) return @ "IPhone 5S"; if ([devicestring isequaltostring:@ "iphone6,2"]) return @ "IPhone 5S"; if ([devicestring isequaltostring:@ "iphone7,1"]) return @ "IPhone 6 Plus"; if ([devicestring isequaltostring:@ "iphone7,2"]) return @ "IPhone 6"; if ([devicestring isequaltostring:@ "iphone8,1"]) return @ "IPhone 6s"; if ([devicestring isequaltostring:@ "iphone8,2"]) return @ "IPhone 6s Plus"; ipod if ([devicestring isequaltostring:@ "ipod1,1"]) return @ "ipod Touch 1G"; if ([devicestring isequaltostring:@ "ipod2,1"]) return @ "IPod Touch 2G"; if ([devicestring isequaltostring:@ "ipod3,1"]) return @ "IPod Touch 3G"; if ([devicestring isequaltostring:@ "ipod4,1"]) return @ "IPod Touch 4G"; if ([devicestring isequaltostring:@ "ipod5,1"]) return @ "IPod Touch 5G"; IPad if ([devicestring isequaltostring:@ "ipad1,1"]) return @ "IPad"; if ([devicestring isequaltostring:@ "ipad2,1"]) return @ "IPad 2 (WiFi)"; if ([devicestring isequaltostring:@ "ipad2,2"]) return @ "IPad 2 (GSM)"; if ([devicestring isequaltostring:@ "ipad2,3"]) return @ "IPad 2 (CDMA)"; if ([devicestring isequaltostring:@ "ipad2,4"]) return @ "IPad 2 (32nm)"; if ([devicestring isequaltostring:@ "ipad2,5"]) return @ "IPad Mini (WiFi)"; if ([devicestring isequaltostring:@ "ipad2,6"]) return @ "IPad Mini (GSM)"; if ([devicestring isequaltostring:@ "ipad2,7"]) return @ "IPad Mini (CDMA)"; if ([devicestring isequaltostring:@ "ipad3,1"]) return @ "IPad 3 (WiFi)"; if ([devicestring isequaltostring:@ "ipad3,2"]) return @ "IPad 3 (CDMA)"; if ([devicestring isequaltostring:@ "ipad3,3"]) return @ "IPad 3 (4G)"; if ([devicestring isequaltostring:@ "ipad3,4"]) return @ "IPad 4 (WiFi)"; if ([devicestring isequaltostring:@ "ipad3,5"]) return @ "IPad 4 (4G)"; if ([Devicestring isequaltostring:@ "ipad3,6"]) return @ "IPad 4 (CDMA)"; if ([devicestring isequaltostring:@ "ipad4,1"]) return @ "IPad Air"; if ([devicestring isequaltostring:@ "ipad4,2"]) return @ "IPad Air"; if ([devicestring isequaltostring:@ "ipad4,3"]) return @ "IPad Air"; if ([devicestring isequaltostring:@ "ipad5,3"]) return @ "IPad Air 2"; if ([devicestring isequaltostring:@ "ipad5,4"]) return @ "IPad Air 2"; if ([devicestring isequaltostring:@ "i386"]) return @ "Simulator"; if ([devicestring isequaltostring:@ "x86_64"]) return @ "Simulator"; if ([devicestring isequaltostring:@ "ipad4,4"] | | [Devicestring isequaltostring:@ "ipad4,5"] | | [Devicestring isequaltostring:@ "ipad4,6"]) return @ "IPad mini 2"; if ([devicestring isequaltostring:@ "ipad4,7"] | | [Devicestring isequaltostring:@ "ipad4,8"] | | [Devicestring isequaltostring:@ "ipad4,9"]) return @ "IPad Mini 3"; return devicestring;}
iOS get device model, device type, and more