0

How do I get the UUID of an iOS application programmatically?

I know we can use command dwarfdump to get the uuid of an iOS application. For example:

Downloads user$ dwarfdump --uuid ./Payload/sdd.app/sdd  UUID: 9D9E0AD2-9925-3CD1-B190-3F9E1EB3A774 (armv7) ./Payload/sdd.app/sdd UUID: E5213B30-5E3B-3BA5-9097-750385F2058B (arm64) ./Payload/sdd.app/sdd

Is there any code can get the UUID in Objective-C or C++?

I want to write this string to log files.

I have searched this on Google, but couldn't find anything. Most of the results are about getting the device's ID.

Chris
  • 7,270
  • 19
  • 66
  • 110
boo
  • 493
  • 6
  • 17

1 Answers1

0

Try this:

-(NSString*) uuid {
CFUUIDRef puuid = CFUUIDCreate( nil );
CFStringRef uuidString = CFUUIDCreateString( nil, puuid );
NSString * result = (NSString *)CFStringCreateCopy( NULL, uuidString);
CFRelease(puuid);
CFRelease(uuidString);
return [result autorelease];
}

you can call this method when the application runs of the first time, and then store it in your phone.

RTzhong
  • 205
  • 1
  • 5
  • 14