mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-02-19 09:11:48 +00:00
Provide an iOS 5 compatible C helper for getting a UUID
This commit is contained in:
@@ -40,6 +40,7 @@ NSComparisonResult bit_versionCompare(NSString *stringA, NSString *stringB);
|
||||
NSString *bit_mainBundleIdentifier(void);
|
||||
NSString *bit_encodeAppIdentifier(NSString *inputString);
|
||||
NSString *bit_appName(NSString *placeHolderString);
|
||||
NSString *bit_UUID(void);
|
||||
NSString *bit_appAnonID(void);
|
||||
|
||||
/* UIImage helpers */
|
||||
|
||||
@@ -158,6 +158,24 @@ NSString *bit_appName(NSString *placeHolderString) {
|
||||
return appName;
|
||||
}
|
||||
|
||||
NSString *bit_UUID(void) {
|
||||
NSString *resultUUID = nil;
|
||||
|
||||
id uuidClass = NSClassFromString(@"NSUUID");
|
||||
if (uuidClass) {
|
||||
resultUUID = [NSUUID UUID];
|
||||
} else {
|
||||
// Create a new UUID
|
||||
CFUUIDRef uuidObj = CFUUIDCreate(nil);
|
||||
|
||||
// Get the string representation of the UUID
|
||||
resultUUID = (NSString*)CFBridgingRelease(CFUUIDCreateString(nil, uuidObj));
|
||||
CFRelease(uuidObj);
|
||||
}
|
||||
|
||||
return resultUUID;
|
||||
}
|
||||
|
||||
NSString *bit_appAnonID(void) {
|
||||
// try iOS6 identifierForVendor
|
||||
SEL vendoridSelector = NSSelectorFromString(@"identifierForVendor");
|
||||
|
||||
Reference in New Issue
Block a user