iphone - The UDID is always returning zero data from keychain in IOS? -
i had application in saving [[[uidevice currentdevice] identifierforvendor] uuidstring]
on keychain this:
nsstring *bundleid = [[[nsbundle mainbundle] infodictionary] objectforkey:@"cfbundleidentifier"]; nsstring *strapplicationuuid; if(![keychainitem objectforkey:(__bridge id)(ksecvaluedata)]){ nsstring *idfa = [[[uidevice currentdevice] identifierforvendor] uuidstring]; nslog(@"bundleid %@",idfa); [keychainitem setobject:idfa forkey:(__bridge id)(ksecvaluedata)]; nslog(@"saving item %@", [keychainitem objectforkey:(__bridge id)(ksecvaluedata)]); strapplicationuuid=[keychainitem objectforkey:(__bridge id)(ksecvaluedata)]; }else{ nslog(@"saved item %@", [keychainitem objectforkey:(__bridge id)(ksecvaluedata)]); strapplicationuuid=[keychainitem objectforkey:(__bridge id)(ksecvaluedata)]; } // nsstring *strapplicationuuidstr = [[nsstring alloc] initwithdata:[keychainitem objectforkey:(__bridge id)(ksecvaluedata)] //encoding:nsutf8stringencoding]; nslog(@"%@",strapplicationuuidstr); nslog(@"%@",strapplicationuuid); return strapplicationuuid;
but giving me 0 data.its not saving first time ,can me on this?
your app may rejected due apple prevent use udid:-
may you:
-(nsstring *)getuniquedeviceidentifierasstring { nsstring *appname=[[[nsbundle mainbundle] infodictionary] objectforkey:(nsstring*)kcfbundlenamekey]; nsstring *strapplicationuuid = [sskeychain passwordforservice:appname account:@"incoding"]; if (strapplicationuuid == nil) { strapplicationuuid = [[[uidevice currentdevice] identifierforvendor] uuidstring]; [sskeychain setpassword:strapplicationuuid forservice:appname account:@"incoding"]; } return strapplicationuuid; }
Comments
Post a Comment