Hello I need to implement ATT for my iOS app ( Apple Developer Documentation ), can someone let me know how this can be done? Do I need to use XCode on a MAC to achieve this? Or can this be done via VoltBuilder somehow??
Based on this post “Implement App Tracking Transparency…”, try the following:
Add this to config.xml:
<plugin name="cordova-plugin-idfa" />
// add permissions to config.xml under ios platform
<platform name="ios">
<edit-config target="NSUserTrackingUsageDescription" file="*-Info.plist" mode="merge">
<string> My tracking usage description </string>
</edit-config>
</platform>
Add this in your code:
// has to be called after platform is ready
// this.platform.ready().then(() => {}
askTrackingPermission() {
if (this.platform.is('cordova') && this.platform.is('ios')) {
if (window.cordova) {
console.log('trying to request permission ');
window.cordova.exec(win, fail, 'idfa', "requestPermission", []);
}
}
function win(res) {
console.log('success ' + JSON.stringify(res));
}
function fail(res) {
console.log('fail ' + JSON.stringify(res));
}
}
readTrackingPermission() {
if (this.platform.is('cordova') && this.platform.is('ios')) {
if (window.cordova) {
window.cordova.exec(win, fail, 'idfa', "getInfo", []);
}
}
function win(res) {
console.log('success ' + JSON.stringify(res));
}
function fail(res) {
console.log('fail ' + JSON.stringify(res));
}
}
Let us know if this works - I have not tried this myself.
Thanks for the reply. I have no issue with adding the first chunk of code into config.xml. My concern is whether I will need to use XCode on a MAC for anything to implement ATT, e.g., with the askTrackingPermission() fnc. If I add the first chunk of code into config.xml, can VoltBuilder add the askTrackingPermission() and readTrackingPermission() fncs for me (wherever necessary)?? Asking because I do not have access to a MAC or XCode.
As I said, I haven’t tried this myself. Others have done it successfully.
It looks like JS code requests the permission. If so, you shouldn’t need Xcode.
Give it a try!