Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMPhobos
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMPhobos
Commits
8f22a750
Commit
8f22a750
authored
Oct 30, 2020
by
jz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix 兼容存储crash
parent
fb9f2e62
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
PhobosDevice.m
GMPhobos/Classes/PhobosDevice.m
+18
-0
No files found.
GMPhobos/Classes/PhobosDevice.m
View file @
8f22a750
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment