Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this plugin supported in AoT (Ahead of time compilation) in {N} + Angular #32

Open
VladimirAmiorkov opened this issue Mar 18, 2017 · 2 comments

Comments

@VladimirAmiorkov
Copy link

VladimirAmiorkov commented Mar 18, 2017

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;
}
@sitefinitysteve
Copy link
Owner

Can i get you to cross post to the forums? http://forum.nativescript.org
I have no NG2 experience with NS let alone AoT :)

@VladimirAmiorkov
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants