5 Replies Latest reply on Jul 7, 2017 11:37 PM by reversot89688892

    CSDKImageEditor is not defined

    reversot89688892

      Hi,

       

      I'm using Ionic v3 and tried integrating the Adobe Creative Cloud CSDKImageEditor plugin (GitHub - CreativeSDK/phonegap-plugin-csdk-image-editor: A PhoneGap plugin for the Creative SDK Image Editor. ), as the plugin is supposedly compatible with Ionic.

       

      I followed all the steps, got the plugin and the Auth plugin successfully installed with client ID/key etc, but after many hours of debugging I can't find any problem with my code and I can only conclude there's something wrong with the plugin itself. If I reference CSDKImageEditor directly, I get an error but this is expected because Ionic requires us to do (<any>window).CSDKImageEditor, so I reference that but that variable is undefined. I've tested that method with other web plugins such as Stripe before successfully, so it's definitely not something on my end.

       

      Any ideas? It seems documentation is really scarce on the plugin and the few people who actually talk about it all face the same issue as me.

        • 1. Re: CSDKImageEditor is not defined
          reversot89688892 Level 1

          One possibility I have in my mind is that there is nothing being imported even though it is a plugin. For example, in Ionic (and I'm sure for PhoneGap as well), when I need to use a plugin I do something like "import { Keyboard } from '@ionic-native/keyboard';" before that plugin is usable. But PhoneGap's CSDK Image Editor plugin is missing this information...

          • 2. Re: CSDKImageEditor is not defined
            kerrishotts Adobe Community Professional

            When using regular PhoneGap / Cordova, the plugins export into the global namespace automatically; no import required. (This is part of why it is necessary to include cordova.js).

             

            The plugin in question clobbers window.CSDKImageEditor, so should be available there. If that is `undefined`, it's possible the plugin isn't getting included in your app (double-check your config.xml), or that you're accessing the variable before `ondeviceready` has fired.

            1 person found this helpful
            • 3. Re: CSDKImageEditor is not defined
              reversot89688892 Level 1

              Thanks kerrishotts, I've checked what you suggested.

              Config.xml shows the plugins properly, and the variable is accessed when cordova is ready.

               

              I have 2 ideas that might be causing this issue:

              1) in GitHub - CreativeSDK/phonegap-plugin-csdk-client-auth: Your starting point for using the Creative SDK PhoneGap plugins! , under "Software Requirements", it simply writes the XCode/iOS/Android Studio/Android SDK requirements and links to the getting started guide. For Cordova, are we supposed to follow the steps in the getting started guide as well? Because the plugin page seems to suggest we do not have to, but then it still links to it which I find weird...

              2) After adding the Client Auth and Image Editor plugins, if I do a "ionic cordova platform remove android" and add it back, it gives me an error regarding 'http://maven.localytics.com/public'. So localytics.com doesn't seem to be accessible by HTTP anymore (error 403) and they seem to have converted fully to HTTPS (btw, this seems like something which needs to be updated with your plugin). So I change the 3 places in the plugin's gradles to https and I can add the platform successfully after this. I do an Android build, and now I can access my app as per normal but after the splashscreen all I see is a white screen.

              • 4. Re: CSDKImageEditor is not defined
                kerrishotts Adobe Community Professional

                1) They mean that you need to be building against the listed SDK & IDE versions as a minimum. If you don't have those versions installed, you'll need to do so. (But I would wager that any attempt to build the app would fail, so my guess is that you satisfy those requirements.)

                 

                2) Not sure what's going on there, but I can browse straight to the http link with no issue, and if I create a temp project using the plugin, I can't duplicate your issue. Maybe a glitch or something? BTW -- the plugin isn't mine. I'm sure the devs would appreciate an issue regarding the URL, though -- you can file one here: Issues · CreativeSDK/phonegap-plugin-csdk-client-auth · GitHub

                 

                2b) white screen: almost always indicates a JavaScript error interrupting startup. You're going to need to connect to Chrome to see what JavaScript errors are getting logged. Watching the device logs would be good as well (adb logcat).

                1 person found this helpful
                • 5. Re: CSDKImageEditor is not defined
                  reversot89688892 Level 1

                  #2a) Ha! This was the problem. I was using a (very reputable) VPN but http://localytics.com does a HTTP 403 against it no matter what. So all I had to do was switch off my VPN and rebuild the platform and it works with a new test app... Such a silly problem, and yet took over a week to find out the cause...

                   

                  Thank you!