Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSString *UUID() {
- CFUUIDRef cfuuid = CFUUIDCreate(NULL);
- NSString *uuid = (__bridge_transfer NSString *)CFUUIDCreateString(NULL, cfuuid);
- CFRelease(cfuuid);
- return uuid;
- }
- uuid = UUID();
- [keychainItemWrapper setObject:uuid forKey:(__bridge_transfer id)kSecAttrAccount];
- NSString *pass_token = randomString(10);
- [keychainItemWrapper setObject:pass_token forKey:(__bridge_transfer id)kSecValueData];
- @implementation EEUserID
- + (NSUUID *) getUUID
- {
- NSUUID *uuid = nil;
- NSString *uuidString = [[NSUbiquitousKeyValueStore defaultStore] stringForKey: @"EEUserID"];
- if (uuidString == nil)
- {
- // This is our first launch for this iTunes account, so we generate random UUID and store it in iCloud:
- uuid = [NSUUID UUID];
- [[NSUbiquitousKeyValueStore defaultStore] setString: uuid.UUIDString forKey: @"EEUserID"];
- [[NSUbiquitousKeyValueStore defaultStore] synchronize];
- }
- else
- {
- uuid = [[NSUUID alloc] initWithUUIDString: uuidString];
- }
- return uuid;
- }
- + (NSString *) getUUIDString
- {
- NSUUID *uuid = [self getUUID];
- if (uuid != nil)
- return uuid.UUIDString;
- else
- return nil;
- }
- + (void) load
- {
- // get changes that might have happened while this
- // instance of your app wasn't running
- [[NSUbiquitousKeyValueStore defaultStore] synchronize];
- }
- @end
- #import <Foundation/Foundation.h>
- @interface EEUserID : NSObject
- + (NSUUID *) getUUID;
- + (NSString *) getUUIDString;
- @end
- NSString *uniqueIDForiTunesAccount = [EEUserID getUUIDString];
- #include "OpenUDID.h"
- NSString* openUDID = [OpenUDID value];
Add Comment
Please, Sign In to add comment