Nakir
Nakir

Reputation: 41

Cordova iOS - plugin not loaded

I'm using Cordova (I tried many versions of this framework, current is 3.5) for iOS development and when I try to use a plugin, each time it's not working. I tried the following plugins: org.apache.cordova.dialogs and com.teamnemitoff.phonedialer.

The installation is complete, files are deployed in the right directories, links in build phase are present (files .m) but nothing works. I saw many discussions about this problem and tried many solutions but nothing solved my issue.

For the notification plugin, it doesn't solve the "undefined" response when I call the navigator.notification.alert method. I tried to add an alert in the js file (notification.js) but the message is not displayed so I assume the plugin is not properly loaded.

Could anyone help me?

Here is the content of the files config.xml and cordova_plugins.js :


cordova_plugins.js located (at platforms/ios/www/)


cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [enter code here
    {
        "file": "plugins/org.apache.cordova.dialogs/www/notification.js",
        "id": "org.apache.cordova.dialogs.notification",
        "merges": [
            "navigator.notification"
        ]
    }
];
module.exports.metadata = 
// TOP OF METADATA
{
    "org.apache.cordova.dialogs": "0.2.10"
}
// BOTTOM OF METADATA
});

`


And config.xml located at (MyTests/platforms/ios/MyTests/config.xml)


<?xml version='1.0' encoding='utf-8'?>
<widget id="com.mydomain.mytests" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <preference name="AllowInlineMediaPlayback" value="false" />
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="BackupWebStorage" value="cloud" />
    <preference name="DisallowOverscroll" value="false" />
    <preference name="EnableViewportScale" value="false" />
    <preference name="FadeSplashScreen" value="true" />
    <preference name="FadeSplashScreenDuration" value=".25" />
    <preference name="KeyboardDisplayRequiresUserAction" value="true" />
    <preference name="MediaPlaybackRequiresUserAction" value="false" />
    <preference name="ShowSplashScreenSpinner" value="true" />
    <preference name="SuppressesIncrementalRendering" value="false" />
    <preference name="TopActivityIndicator" value="gray" />
    <preference name="GapBetweenPages" value="0" />
    <preference name="PageLength" value="0" />
    <preference name="PaginationBreakingMode" value="page" />
    <preference name="PaginationMode" value="unpaginated" />
    <feature name="LocalStorage">
        <param name="ios-package" value="CDVLocalStorage" />
    </feature>
    <name>MyTests</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="[email protected]" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <feature name="Notification">
        <param name="ios-package" value="CDVNotification" />
    </feature>
</widget>

Upvotes: 4

Views: 1570

Answers (1)

Tien Nguyen
Tien Nguyen

Reputation: 599

Try to add <script src="cordova.js"></script> in your view

Upvotes: 0

Related Questions