Use passed device, follow create policy forf CFUUIDCreate

Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/5ec060ea
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/5ec060ea
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/5ec060ea

Branch: refs/heads/1.1.x
Commit: 5ec060eab4ce41f75be1e04a799da9c305d18081
Parents: 603c243
Author: Jesse MacFadyen <purplecabb...@gmail.com>
Authored: Fri Apr 8 23:37:20 2016 -0700
Committer: Jesse MacFadyen <purplecabb...@gmail.com>
Committed: Fri Apr 8 23:37:20 2016 -0700

----------------------------------------------------------------------
 src/ios/CDVDevice.m | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/5ec060ea/src/ios/CDVDevice.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVDevice.m b/src/ios/CDVDevice.m
index 7b05fc6..4d75a57 100644
--- a/src/ios/CDVDevice.m
+++ b/src/ios/CDVDevice.m
@@ -55,10 +55,12 @@
     // which didn't user identifierForVendor
     NSString* app_uuid = [userDefaults stringForKey:UUID_KEY];
     if (app_uuid == nil) {
-        if ([[UIDevice currentDevice] 
respondsToSelector:@selector(identifierForVendor)]) {
+        if ([device respondsToSelector:@selector(identifierForVendor)]) {
             app_uuid = [[device identifierForVendor] UUIDString];
         } else {
-            app_uuid = (__bridge NSString *) CFUUIDCreateString(NULL, 
CFUUIDCreate(NULL));
+            CFUUIDRef uuid = CFUUIDCreate(NULL);
+            app_uuid = (__bridge_transfer NSString *)CFUUIDCreateString(NULL, 
uuid);
+            CFRelease(uuid);
         }
 
         [userDefaults setObject:app_uuid forKey:UUID_KEY];


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to