Guest User

Untitled

a guest
Jan 16th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. NSString *UUID() {
  2. CFUUIDRef cfuuid = CFUUIDCreate(NULL);
  3. NSString *uuid = (__bridge_transfer NSString *)CFUUIDCreateString(NULL, cfuuid);
  4. CFRelease(cfuuid);
  5. return uuid;
  6. }
  7.  
  8. uuid = UUID();
  9. [keychainItemWrapper setObject:uuid forKey:(__bridge_transfer id)kSecAttrAccount];
  10. NSString *pass_token = randomString(10);
  11. [keychainItemWrapper setObject:pass_token forKey:(__bridge_transfer id)kSecValueData];
  12.  
  13. @implementation EEUserID
  14.  
  15. + (NSUUID *) getUUID
  16. {
  17. NSUUID *uuid = nil;
  18. NSString *uuidString = [[NSUbiquitousKeyValueStore defaultStore] stringForKey: @"EEUserID"];
  19. if (uuidString == nil)
  20. {
  21. // This is our first launch for this iTunes account, so we generate random UUID and store it in iCloud:
  22. uuid = [NSUUID UUID];
  23. [[NSUbiquitousKeyValueStore defaultStore] setString: uuid.UUIDString forKey: @"EEUserID"];
  24. [[NSUbiquitousKeyValueStore defaultStore] synchronize];
  25. }
  26. else
  27. {
  28. uuid = [[NSUUID alloc] initWithUUIDString: uuidString];
  29. }
  30.  
  31. return uuid;
  32. }
  33.  
  34. + (NSString *) getUUIDString
  35. {
  36. NSUUID *uuid = [self getUUID];
  37. if (uuid != nil)
  38. return uuid.UUIDString;
  39. else
  40. return nil;
  41. }
  42.  
  43. + (void) load
  44. {
  45. // get changes that might have happened while this
  46. // instance of your app wasn't running
  47. [[NSUbiquitousKeyValueStore defaultStore] synchronize];
  48. }
  49.  
  50. @end
  51.  
  52. #import <Foundation/Foundation.h>
  53.  
  54. @interface EEUserID : NSObject
  55.  
  56. + (NSUUID *) getUUID;
  57. + (NSString *) getUUIDString;
  58.  
  59. @end
  60.  
  61. NSString *uniqueIDForiTunesAccount = [EEUserID getUUIDString];
  62.  
  63. #include "OpenUDID.h"
  64. NSString* openUDID = [OpenUDID value];
Add Comment
Please, Sign In to add comment