IOS cordova issue. Can't find variable

I am getting error while testing app on IOS device

ReferenceError: Can’t find variable: cordova

are you loading cordova.js in the header of your index.html?

yes i am using in head tag

then you are not waiting until the device/ionic is ready.

maybe you have native functionality in a controller / service which is executed before that.

You should see the line of code the error occurs… maybe that gives you a hint.

Can you post your header file and also post the code of where you reference the cordova variable at all? That can help us determine exactly why it might not be showing up too. Though it’s likely you are using it outside of device ready like @bengtler was saying.

Hello same error on IOS DEVICE.

ReferenceError: Can’t find variable: cordova
Do you have any recommandation ?

I bootstrap my app like

    <script src="lib/ionic/js/ionic.bundle.js"></script>
    <script src="lib/ionic-service-core/ionic-core.js"></script>
    <script src="lib/ionic-service-push/ionic-push.js"></script>
    <script src="cordova.js"></script>
    <script src="lib/ngCordova/dist/ng-cordova.js"></script>

I bootstrap my app with :

if (window.cordova) {
        document.addEventListener('deviceready', function() {
            console.log("device ready");
                        angular.element(document).ready(function() {
                        angular.bootstrap(document.body, ['MyApp']);
        }, false);

I’m stuck with this error without understand why …

1 Like

Have you found a solution? I have the same problem…

i think the problem is what you should put the cordova.js above ib/ngCordova/dist/ng-cordova.js like this

<script src=“lib/ionic/js/ionic.bundle.js”></script>
<script src=“lib/ionic-service-core/ionic-core.js”></script>
<script src=“lib/ionic-service-push/ionic-push.js”></script>
<script src=“lib/ngCordova/dist/ng-cordova.js”></script>
<script src=“cordova.js”></script>

Sorry for my bad english

check Your internet connection working or not if You Are livereloading in ios