All cordova plugin undefined on IOS

Hi,

All my cordova plugins don’t work when I test on IOS devices.
They all work perfectly on android.

I did try to remove the platform and re-add it.
I did check that all plugins were in the platforms/projectName/plugins folder.
I did wrap my cordova calls in $ionicplatform.ready
They are all listed when I type cordova plugin list

What I get in my console log when I debug it is:

Error: undefined is not an object (evaluating 'window.plugins.allMyPlugins')
Or also, for the cordova camera, I get
Error: Can't find variable: Camera

Also, very weird, when I
$ionicPlatform.ready(function() {
console.log(window.cordova.plugins);
});
to see what plugins actually get loaded, I only get:
Object [keyboard] => as if only they keyboard plugin was loaded…

I am using Cordova 5.4.1 (I cannot even build with the new cordova 6.0.0)

I am testing on Iphone 4.

Any help, I beg you all. This is the very last step for me to publish my app on apple store. :’(

I am still stuck with this issue, there doesn’t seem to be any workaround.

Still asking for help :slight_smile:

hi,

did you try to remove the the plugins
and reinstall them ?

and then run ionic build iOS

Thanks for taking the time.

Unfortunately yes, I tried that as well.

Removing them, adding them one by one, building etc.

Can I provide any other info that could help debug my situation?

wich plugins r u using

and do you use Xcode for running the app

and can you copy you’re config.xml pls

here are my plugins:

cc.fovea.cordova.purchase 4.0.0 "Purchase"
com.ionic.keyboard 1.0.4 "Keyboard"
com.telerik.plugins.nativepagetransitions 0.5.5 "Native Page Transitions"
cordova-plugin-app-version 0.1.8 "AppVersion"
cordova-plugin-camera 1.2.0 "Camera"
cordova-plugin-console 1.0.2 "Console"
cordova-plugin-dialogs 1.2.0 "Notification"
cordova-plugin-facebook4 1.3.0-0 "Facebook Connect"
cordova-plugin-globalization 1.0.2-dev "Globalization"
cordova-plugin-google-analytics 0.8.1 "Google Universal Analytics Plugin"
cordova-plugin-network-information 1.2.0 "Network Information"
cordova-plugin-themeablebrowser 0.2.12 "ThemeableBrowser"
cordova-plugin-whitelist 1.0.0 "Whitelist"
cordova-plugin-x-socialsharing 5.0.7 "SocialSharing"
cordova-plugin-x-toast 2.2.1 "Toast"
de.appplant.cordova.plugin.email-composer 0.8.3dev "EmailComposer"
ionic-plugin-deploy 0.4.1 "IonicDeploy"
ionic-plugin-keyboard 1.0.8 "Keyboard"
onesignal-cordova-plugin 1.9.0 "OneSignal Push Notifications"
org.apache.cordova.device 0.3.0 "Device"
org.apache.cordova.inappbrowser 0.6.0 "InAppBrowser"
org.apache.cordova.splashscreen 1.0.0 "Splashscreen"
org.apache.cordova.statusbar 0.1.10 "StatusBar"

Also, to test my app and since I’m not familiar with xcode since I just started on mac, I build my .ipa using ionic package build ios, then I add it to my device using itunes (with a provisioning profile for the device)

Here is my config.xml:

<content src="index.html"/>
  <access origin="*"/>
  <allow-intent href="*.firebaseio.com"/>
  <allow-intent href="auth.firebase.com"/>
  <preference name="StatusBarOverlaysWebview" value="false"/>
  <preference name="webviewbounce" value="false"/>
  <preference name="UIWebViewBounce" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="android-minSdkVersion" value="16"/>
  <preference name="BackupWebStorage" value="none"/>
  <preference name="SplashScreen" value="screen"/>
  <preference name="SplashScreenDelay" value="5000"/>
  <preference name="FadeSplashScreenDuration" value="1"/>
  <preference name="KeyboardDisplayRequiresUserAction" value="false"/>
  <preference name="orientation" value="portrait"/>
  <feature name="StatusBar">
    <param name="ios-package" onload="true" value="CDVStatusBar"/>
  </feature>
  <feature name="Camera">
    <param name="ios-package" value="CDVCamera"/>
    <param name="android-package" value="org.apache.cordova.camera.CameraLauncher"/>
  </feature>
  <platform name="android">
    <icon src="resources\android\icon\drawable-ldpi-icon.png" density="ldpi"/>
    <icon src="resources\android\icon\drawable-mdpi-icon.png" density="mdpi"/>
    <icon src="resources\android\icon\drawable-hdpi-icon.png" density="hdpi"/>
    <icon src="resources\android\icon\drawable-xhdpi-icon.png" density="xhdpi"/>
    <icon src="resources\android\icon\drawable-xxhdpi-icon.png" density="xxhdpi"/>
    <icon src="resources\android\icon\drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
    <splash src="resources\android\splash\drawable-port-ldpi-screen.png" density="port-ldpi"/>
    <splash src="resources\android\splash\drawable-port-mdpi-screen.png" density="port-mdpi"/>
    <splash src="resources\android\splash\drawable-port-hdpi-screen.png" density="port-hdpi"/>
    <splash src="resources\android\splash\drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
    <splash src="resources\android\splash\drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
    <splash src="resources\android\splash\drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
  </platform>
  <platform name="ios">
    <icon src="resources\ios\icon\icon.png" width="57" height="57"/>
    <icon src="resources\ios\icon\icon@2x.png" width="114" height="114"/>
    <icon src="resources\ios\icon\icon-40.png" width="40" height="40"/>
    <icon src="resources\ios\icon\icon-40@2x.png" width="80" height="80"/>
    <icon src="resources\ios\icon\icon-50.png" width="50" height="50"/>
    <icon src="resources\ios\icon\icon-50@2x.png" width="100" height="100"/>
    <icon src="resources\ios\icon\icon-60.png" width="60" height="60"/>
    <icon src="resources\ios\icon\icon-60@2x.png" width="120" height="120"/>
    <icon src="resources\ios\icon\icon-60@3x.png" width="180" height="180"/>
    <icon src="resources\ios\icon\icon-72.png" width="72" height="72"/>
    <icon src="resources\ios\icon\icon-72@2x.png" width="144" height="144"/>
    <icon src="resources\ios\icon\icon-76.png" width="76" height="76"/>
    <icon src="resources\ios\icon\icon-76@2x.png" width="152" height="152"/>
    <icon src="resources\ios\icon\icon-small.png" width="29" height="29"/>
    <icon src="resources\ios\icon\icon-small@2x.png" width="58" height="58"/>
    <icon src="resources\ios\icon\icon-small@3x.png" width="87" height="87"/>
    <splash src="resources\ios\splash\Default-568h@2x~iphone.png" width="640" height="1136"/>
    <splash src="resources\ios\splash\Default-667h.png" width="750" height="1334"/>
    <splash src="resources\ios\splash\Default-736h.png" width="1242" height="2208"/>
    <splash src="resources\ios\splash\Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
    <splash src="resources\ios\splash\Default-Portrait~ipad.png" width="768" height="1024"/>
    <splash src="resources\ios\splash\Default@2x~iphone.png" width="640" height="960"/>
    <splash src="resources\ios\splash\Default~iphone.png" width="320" height="480"/>
  </platform>
  <platform name="wp8">
    <icon src="resources\wp8\icon\ApplicationIcon.png" width="99" height="99"/>
    <icon src="resources\wp8\icon\Background.png" width="159" height="159"/>
    <splash src="resources\wp8\splash\SplashScreenImage.png" width="768" height="1280"/>
  </platform>
  <icon src="resources\android\icon\drawable-xhdpi-icon.png"/>
  <plugin name="cordova-plugin-facebook4" spec="^1.3.0-0">
    <variable name="APP_ID" value="XXX"/>
    <variable name="APP_NAME" value="XXX"/>
  </plugin>

Problem fixed thanks to @ItamarCohen who helped me a lot! :smiley:

Apparently, building with ionic package didn’t take into account all my plugins, and most of my changes… whereas building with Xcode properly takes everything into account, it now works smoothly. :slightly_smiling:

1 Like

How can you help the problem?
As I am facing this problem and struggling for more than 2 days.

Well…what was the fix? I am having a similar issue but ONLY when testing my app via Ionic Serve to the browser, app works just fine on Phones and Simulators.