nativescript-google-analytics
nativescript-google-analytics copied to clipboard
Is this plugin supported in AoT (Ahead of time compilation) in {N} + Angular
Hi,
I am experiencing some errors when I am packaging a project for iOS that uses this plugin. I am doing this workflow for bundling the app and I am getting this error once the app is opened:
file:///app/bundle.js:10941:25: JS ERROR TypeError: Attempted to assign to readonly property. Mar 18 17:54:12 com.apple.CoreSimulator.SimDevice.8A380AE0-BE8A-464E-B1E9-12E1D1F1E55A.launchd_sim[433] (UIKitApplication:com.cobbl.app[0xd1af][5260]): Service exited due to Segmentation fault: 11
This line bundle.js:10941:25 is the bundled code for the initialization of the plugin via the delegate on iOS as described here.
Workaround: What I ended up doing is to follow this article of extending the UIResponder:
import * as applicationModule from "application";
if (applicationModule.ios) {
var MyAppDelegate = UIResponder.extend({
// My custom logic here
return true;
}
}, {
name: "MyAppDelegate",
protocols: [UIApplicationDelegate]
});
applicationModule.ios.delegate = MyAppDelegate;
}
Can i get you to cross post to the forums? http://forum.nativescript.org I have no NG2 experience with NS let alone AoT :)
Hi @sitefinitysteve , Sure I also think to look into this myself and see if I can fix it. It looks to be an issue with the way an UIResponder in iOS is extended since the code for workaround I posted works in AoT Angular.