我想知道如何克服iOS 7 udid issue。
我们已经尝试过了:我们已经实现了vendorUniqueID,正如苹果所建议的那样,一旦用户卸载应用程序,它将被更改,因此不是一个好的选择。
广告唯一的标识不是一个选项;正如苹果公司建议的那样,它只用于广告目的。因为我们的应用不是广告展示应用。
我们需要知道的是:我们已经有了恢复id,是否有一种方法可以在重新安装应用程序之后检索到store that restoration ID。
我想知道Google的分析版和“狂暴分析版”是如何跟踪的。
发布于 2013-10-06 05:51:45
您可以通过执行以下步骤来完成此操作。
1)在项目中导入<Security/Security.h>。
2)使用SecItemAdd方法将详细信息保存到密钥链中。
-(void) saveUsername:(NSString*)user withPassword:(NSString*)pass forServer:(NSString*)server {
// Create dictionary of search parameters
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:kSecClassInternetPassword, kSecClass, server, kSecAttrServer, kCFBooleanTrue, kSecReturnAttributes, nil];
// Remove any old values from the keychain
OSStatus err = SecItemDelete((CFDictionaryRef) dict);
// Create dictionary of parameters to add
NSData* passwordData = [pass dataUsingEncoding:NSUTF8StringEncoding];
dict = [NSDictionary kSecClassInternetPassword, kSecClass, server, kSecAttrServer, passwordData, kSecValueData, user, kSecAttrAccount, nil];
// Try to save to keychain
err = SecItemAdd((CFDictionaryRef) dict, NULL);
}3)即使删除了应用程序,也可以从密钥链中获取存储的数据。
-(void) getCredentialsForServer:(NSString*)server {
// Create dictionary of search parameters
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:kSecClassInternetPassword, kSecClass, server, kSecAttrServer, kCFBooleanTrue, kSecReturnAttributes, nil];
// Look up server in the keychain
NSDictionary* found = nil;
OSStatus err = SecItemCopyMatching((CFDictionaryRef) dict, (CFDictionaryRef*) &found);
if (!found) return;
// Found
NSString* user = (NSString*) [found objectForKey:kSecAttrAccount];
NSString* pass = [[NSString alloc] initWithData:[found objectForKey:kSecValueData] encoding:NSUTF8StringEncoding];
UIAlertView * alertView=[[UIAlertView alloc] initWithTitle:@"Key found" message:[NSString stringWithFormat:@"user : %@ pass :%@",user,pass] delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil] ;
[alertView show];
NSLog(@"user %@ : pass %@", user,pass);
}4)如果您想要从密钥链中删除此属性字典,您可以这样做。
-(void) removeAllCredentialsForServer:(NSString*)server {
// Create dictionary of search parameters
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:kSecClassInternetPassword, kSecClass, server, kSecAttrServer, kCFBooleanTrue, kSecReturnAttributes, kCFBooleanTrue, kSecReturnData, nil];
// Remove any old values from the keychain
OSStatus err = SecItemDelete((CFDictionaryRef) dict);
}发布于 2013-10-03 20:49:13
即使应用程序被删除,存储到密钥链中的任何信息也将被还原。
https://stackoverflow.com/questions/19166538
复制相似问题