发布于 

ios获取idfa

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
if (uni.getSystemInfoSync().platform == 'ios') {
var NSUUID = plus.ios.importClass('NSUUID');
var UIDevice = plus.ios.importClass("UIDevice");
var currentDevice = UIDevice.currentDevice()
var identifierForVendor = currentDevice.identifierForVendor().UUIDString();
var ASIdentifierManager = plus.ios.importClass("ASIdentifierManager");
var sharedManager = ASIdentifierManager.sharedManager();
if (sharedManager.isAdvertisingTrackingEnabled()) {
var advertisingIdentifier = sharedManager.advertisingIdentifier();
var idfa2 = plus.ios.invoke(advertisingIdentifier, "UUIDString");
}
// var result = {'idfa':idfa,'idfv':identifierForVendor}
// uni.showToast({
// title: "2-idfa:" + idfa2,
// position: 'center',
// duration: 2500
// });
}