307594386@qq.com
307594386@qq.com
  • 发布:2019-05-14 15:02
  • 更新:2019-05-17 20:59
  • 阅读:880

苹果ios获取idfa报错,社区的代码我都试过了,出现[ERROR] : thirdScriptError nul 错误

分类:HTML5+

苹果ios获取idfa报错,社区的代码我都试过了

代码一:
console.log('UUID:'+plus.device.uuid)
console.log('important')
var NSUUID = plus.ios.importClass('NSUUID');
var UIDevice = plus.ios.importClass("UIDevice");
var currentDevice = UIDevice.currentDevice()
var identifierForVendor = currentDevice.identifierForVendor().UUIDString();
console.log('IDFV:'+identifierForVendor)

var ASIdentifierManager = plus.ios.importClass('ASIdentifierManager');    
var sharedManager = ASIdentifierManager.sharedManager();    
var IDFA = sharedManager.advertisingIdentifier().UUIDString();    
console.log('IDFA:'+IDFA);    

alert(IDFA);

代码二:

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 idfa = plus.ios.invoke(advertisingIdentifier,"UUIDString");
}
var result = {'idfa':idfa,'idfv':identifierForVendor}
return result;

都报错!

出现[ERROR] : thirdScriptError null is not an object (evaluating 'ASIdentifierManager.sharedManager'); [Component] Event Handler Error 错误

完整错误:

14:26:48.902 [LOG] : UUID:0AF82527-91F4-49A7-800E-24417F5789C2
14:26:48.931 [LOG] : important
14:26:48.951 [LOG] : IDFV:5A4E8CD6-179C-42D9-9B56-D3ACD0BDF0AB
14:26:48.971 [ERROR] : thirdScriptError
14:26:48.971 null is not an object (evaluating 'ASIdentifierManager.sharedManager'); [Component] Event Handler Error @ pages/index/index#bound handleProxy
14:26:48.971 test
14:26:48.972 tap
14:26:48.972 handleProxyWithVue
14:26:48.972 handleProxy@[native code]
14:26:48.972 file:///var/mobile/Containers/Data/Application/6C33E8E2-1362-46EA-987C-A166D53DA516/Documents/Pandora/apps/7CBAD7ECA09947071F49C51A10BED729/www/uniappservice.html:2:619583
14:26:48.972 file:///var/mobile/Containers/Data/Application/6C33E8E2-1362-46EA-987C-A166D53DA516/Documents/Pandora/apps/7CBAD7ECA09947071F49C51A10BED729/www/
uniappservice.html:2:715484
14:26:48.972 file:///var/mobile/Containers/Data/Application/6C33E8E2-1362-46EA-987C-A166D53DA516/Documents/Pandora/apps/7CBAD7ECA09947071F49C51A10BED729/www/uniappservice.html:2:718467
14:26:48.972 D65@file:///var/mobile/Containers/Data/Application/6C33E8E2-1362-46EA-987C-A166D53DA516/Documents/Pandora/apps/7CBAD7ECA09947071F49C51A10BED729/www/
uniappservice.html:2:101256
14:26:48.972 w3@file:///var/mobile/Containers/Data/Application/6C33E8E2-1362-46EA-987C-A166D53DA516/Documents/Pandora/apps/7CBAD7ECA09947071F49C51A10BED729/www/uniappservice.html:2:98082
14:26:48.972 file:///var/mobile/Containers/Data/Application/6C33E8E2-1362-46EA-987C-A166D53DA516/Documents/Pandora/apps/7CBAD7ECA09947071F49C51A10BED729/www/
uniappservice.html:1:291
14:26:48.972 file:///var/mobile/Containers/Data/Application/6C33E8E2-1362-46EA-987C-A166D53DA516/Documents/Pandora/apps/7CBAD7ECA09947071F49C51A10BED729/www/uniappservice.html:2:207248
14:26:48.972 file:///var/mobile/Containers/Data/Application/6C33E8E2-1362-46EA-987C-A166D53DA516/Documents/Pandora/apps/7CBAD7ECA09947071F49C51A10BED729/www/
uniappservice.html:2:412926

2019-05-14 15:02 负责人:无 分享
已邀请:
DCloud_IOS_CLP

DCloud_IOS_CLP

有专门的api 获取uuid http://www.html5plus.org/doc/zh_cn/device.html

DCloud_IOS_CLP

DCloud_IOS_CLP

var ASIdentifierManager = plus.ios.import("ASIdentifierManager");
var sharedManager = ASIdentifierManager.sharedManager();
var adver = plus.ios.invoke(sharedManager, "advertisingIdentifier");
var IDFA = plus.ios.invoke(adver,"UUIDString");
console.log('IDFA:' + JSON.stringify(IDFA)); 这样写应该也可以

  • 307594386@qq.com (作者)

    ios的 appendJsFile 这个怎么怎么使用,我用了好像注入不进去js 能帮我看看吗

    2019-05-23 18:10

  • 307594386@qq.com (作者)

    https://ask.dcloud.net.cn/question/71565

    2019-05-23 18:13

  • 380434797@qq.com

    TypeError: null is not an object (evaluating 'ASIdentifierManager.sharedManager') 还是报这个错误,我已经在


    manifest.json中添加了

    "plus" : {

    "distribute" : {

    "apple" : {"frameworks" : ["AdSupport.framework"],

    "idfa":true

    }


    }

    2019-06-25 16:09

要回复问题请先登录注册