xcode - IOS 8 / 7 unique user identifier -
as of ios8 , ios7 there way retrieve unique id each user of app? need identify every user of app , register on database in order have statistics how can it?
you can use uuid.its important save uuid in nsuserdefault once generated because uuid different each generation.
+ (nsstring*)getappuuid { nsuserdefaults *userdefaults = [nsuserdefaults standarduserdefaults]; nsstring *uuid = [userdefaults objectforkey:nslocalizedstring(@"devicetoken",nil)]; if(!uuid) { cfuuidref uuidref = cfuuidcreate(null); cfstringref uuidstringref = cfuuidcreatestring(null, uuidref); cfrelease(uuidref); uuid = (__bridge nsstring *)uuidstringref ; [userdefaults setobject:uuid forkey:nslocalizedstring(@"devicetoken",nil)]; [userdefaults synchronize]; } return uuid; }
to generate uuid,you can use below method ios 6
[[uidevice currentdevice]identifierforvendor]
Comments
Post a Comment