The application requires an identifier, but since the UDID banned from being used in iOS 6 , I have to ask you: C. What can replace UDID ?

I tried NSUUID

 NSString *uuid = [[NSUUID UUID] UUIDString]; 

Changes after reinstalling the application.

Tried "IDFV" Identifier for Vendor :

 NSString *idfv = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; 

But it also changes (and it is not clear why, it happens again returns the old identifier).

I also wanted to try Advertiser Identifier , but ASIdentifierManager and advertisingIdentifier not recognized by xCode. The program is ready for updating in xCode and iTunesConnect , already before uploading to iTunes noticed that the identifier changed. Please tell me already ready solution, by 18:00 I plan to upload to iTunes . Thanks a lot in advance).

    2 answers 2

    Duck is a UIID and then a UIID - it should be different every second of a second all over the world. If you want a non-editable UIID, then earlier, yes, you used a device identifier. In this connection, advertisers abused the collection of this information. And now this function is controlled by the user. Today we got out of this situation by requesting the GSM address of the GSM / Wi-Fi podley, after the hash of the md5-like function we got the UID.

    Here is an example implementation:

     @implementation TCMacAddress + (NSString *)getMacAddress { int mgmtInfoBase[6]; char *msgBuffer = NULL; size_t length; unsigned char macAddress[6]; struct if_msghdr *interfaceMsgStruct; struct sockaddr_dl *socketStruct; NSString *errorFlag = NULL; // Setup the management Information Base (mib) mgmtInfoBase[0] = CTL_NET; // Request network subsystem mgmtInfoBase[1] = AF_ROUTE; // Routing table info mgmtInfoBase[2] = 0; mgmtInfoBase[3] = AF_LINK; // Request link layer information mgmtInfoBase[4] = NET_RT_IFLIST; // Request all configured interfaces // With all configured interfaces requested, get handle index if ((mgmtInfoBase[5] = if_nametoindex("en0")) == 0) errorFlag = @"if_nametoindex failure"; else { // Get the size of the data available (store in len) if (sysctl(mgmtInfoBase, 6, NULL, &length, NULL, 0) < 0) errorFlag = @"sysctl mgmtInfoBase failure"; else { // Alloc memory based on above call if ((msgBuffer = malloc(length)) == NULL) errorFlag = @"buffer allocation failure"; else { // Get system information, store in buffer if (sysctl(mgmtInfoBase, 6, msgBuffer, &length, NULL, 0) < 0) errorFlag = @"sysctl msgBuffer failure"; } } } // Befor going any further... if (errorFlag != NULL) { NSLog(@"Error: %@", errorFlag); return errorFlag; } // Map msgbuffer to interface message structure interfaceMsgStruct = (struct if_msghdr *) msgBuffer; // Map to link-level socket structure socketStruct = (struct sockaddr_dl *) (interfaceMsgStruct + 1); // Copy link layer address data in socket structure to an array memcpy(&macAddress, socketStruct->sdl_data + socketStruct->sdl_nlen, 6); // Read from char array into a string object, into traditional Mac address format NSString *macAddressString = [NSString stringWithFormat:@"%02X:%02X:%02X:%02X:%02X:%02X", macAddress[0], macAddress[1], macAddress[2], macAddress[3], macAddress[4], macAddress[5]]; //NSLog(@"Mac Address: %@", macAddressString); // Release the buffer memory free(msgBuffer); return macAddressString; } @end 
    • mgmtInfoBase [0] = CTL_NET; mgmtInfoBase [1] = AF_ROUTE; mgmtInfoBase [3] = AF_LINK; mgmtInfoBase [4] = NET_RT_IFLIST; Swears at them, they say the use of not declared identifier) ​​"use of undeclared identifier" Also errors - f3.s.qip.ru/MQ9HpEaH.png (I apologize that in the screenshot, but I could not copy the text) TCMacAddress.m set as "TCMacAddress : UIResponder ". What is the problem)? - SuperPonchik
    • one
      oh, probably probably in Xcode code ^ _ ^ Try to register imports: `` `#import <sys / socket.h> #import <sys / sysctl.h> #import <net / if.h> #import <net / if_dl. h> `` ` - BiMaWa
    • one
      Oh, not by knowing the parts of papah: NSString * macAddress = [TCMacAddress getMacAddress]; - BiMaWa
    • Thanks) - SuperPonchik
    • one
      In TCMacAddress.h the contents of this type? @interface TCMacAddress: NSObject + (NSString *) getMacAddress; @end If not, leave me alone. - BiMaWa

    Tracking device is prohibited by apple. You can track users for example by their username, but for this to happen in your application it must somehow be implemented. You cannot track the devices themselves.

    • How sad it is ..: C - SuperPonchik
    • I, too, at one time very much broken off. - huffman
    • OpenUDID is also prohibited? It seems you can somehow get it ... - SuperPonchik
    • does it change? - SuperPonchik