Commit 8f22a750 authored by jz's avatar jz

bugfix 兼容存储crash

parent fb9f2e62
......@@ -9,6 +9,7 @@
#import <AdSupport/ASIdentifierManager.h>
#import <SAMKeychain/SAMKeychain.h>
#import <GMCache/GMCache.h>
#import "PhobosUtil.h"
//#import <AppTrackingTransparency/AppTrackingTransparency.h>
NSString *const KprivatePolicyNotification = @"gm_popup_private_policy_notification";
......@@ -21,6 +22,12 @@ NSString *const IDFA = @"idfa";
// 默认获取不到的idfa
NSString *defaultIDFA = @"00000000-0000-0000-0000-000000000000";
static dispatch_queue_t queue;
@interface PhobosDevice()
@property (class, nonatomic, strong) NSMutableDictionary *paramsDic;
@end
@implementation PhobosDevice
#pragma mark - getIDFA
......@@ -139,8 +146,18 @@ NSString *defaultIDFA = @"00000000-0000-0000-0000-000000000000";
#pragma mark - 钥匙串封装
+ (void)saveKeyChainWithValue:(NSString *)value service:(NSString *)service account:(NSString *)account {
//避免在重复相同的key 重复设置
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
queue = dispatch_queue_create("com.device.idfa.serial.queue", DISPATCH_QUEUE_SERIAL);
});
if (queue && [PhobosUtil isNonEmpty:service] && ![self checkIdfaIsNull:value]) {
dispatch_sync(queue, ^{
[SAMKeychain setPassword:value forService:service account:account];
[SAMKeychain setAccessibilityType:kSecAttrAccessibleAlwaysThisDeviceOnly];
});
}
}
//根据 service 与账户keyChain 获取存储的值
......@@ -151,4 +168,5 @@ NSString *defaultIDFA = @"00000000-0000-0000-0000-000000000000";
+ (BOOL)showPrivatePolicy {
return [GMCache fetchObjectAtDocumentPathWithkey:KprivatePolicyNotification];
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment