Cordova iOS - 插件未加载

时间:2014-11-26 13:14:25

标签: javascript ios cordova plugins

我正在使用Cordova(我试过这个框架的许多版本,目前是3.5)用于iOS开发,当我尝试使用插件时,每次它都不起作用。我尝试了以下插件:org.apache.cordova.dialogs和com.teamnemitoff.phonedialer。

安装完成,文件部署在正确的目录中,构建阶段的链接存在(文件.m)但没有任何作用。我看到很多关于这个问题的讨论并尝试了很多解决方案,但没有解决我的问题。

对于通知插件,当我调用navigator.notification.alert方法时,它不解决“未定义”响应。我试图在js文件(notification.js)中添加警报,但是没有显示消息,所以我认为插件没有正确加载。

有人可以帮助我吗?

以下是config.xml和cordova_plugins.js文件的内容:


cordova_plugins.js(在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
});

`


config.xml位于(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="dev@cordova.apache.org" 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>

1 个答案:

答案 0 :(得分:0)

尝试在您的视图中添加<script src="cordova.js"></script>