我用Ionic制作了一个App,然后将它部署到我的iPhone上。结果如下:
(lldb) 2015-03-21 12:25:01.541 Foo[545:102930] CDVPlugin class CDVDevice (pluginName: Device) does not exist.
2015-03-21 12:25:01.542 Foo[545:102930] ERROR: Plugin 'Device' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
(lldb) 2015-03-21 12:25:01.543 Foo[545:102930] -[CDVCommandQueue executePending] [Line 158] FAILED pluginJSON = [
"Device492387493",
"Device",
"getDeviceInfo",
[
]
]
命令cordova plugins
列出了设备插件:
abc:Foo user$ cordova plugins
com.google.cordova.admob 2.7.4 "AdMob Plugin Pro"
com.google.playservices 19.0.0 "Google Play Services for Android"
com.ionic.keyboard 1.0.4 "Keyboard"
com.rjfun.cordova.extension 1.0.6 "Cordova Plugin Extension"
org.apache.cordova.console 0.2.13 "Console"
org.apache.cordova.device 0.3.0 "Device"
我的config.xml
:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="a.b.c" version="1.1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Foo</name>
<description>
Foo App.
</description>
<author email="foo@foo.com" href="http://Foo.foo/">
WestByte
</author>
<content src="index.html"/>
<access origin="*"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="BackupWebStorage" value="none"/>
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true"/>
</feature>
</widget>
当我调试它时,我从未进入$ionicPlatform.ready
:
angular.module('starter', ['ionic', 'starter.controllers', 'ngCordova'])
.run(function($ionicPlatform, $cordovaAdMob) {
$ionicPlatform.ready(function() {
// this point is never reached
});
})
这里有什么问题?
答案 0 :(得分:1)
您需要在iOS平台文件夹中手动设置config.xml,而不是外部。
config.xml中
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.revivalx.cordova.todomobile" 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>YourProjectName</name>
<description>
Your project description.
</description>
<author email="mohammadnrdn@gmail.com" href="http://revivalx.com">
Mohammad Nurdin bin Norazan
</author>
<content src="index.html" />
<access origin="*" />
<feature name="Device">
<param name="ios-package" value="CDVDevice" />
</feature>
</widget>