0
我們有一個項目,它有一些自定義插件。問題是,當我做科爾多瓦插件的JS文件沒有被複制到平臺/文件夾
cordova build ios
那麼插件JS文件不會被複制到平臺/ IOS/WWW /插件/,即使生成成功沒有任何錯誤,但是當我嘗試安裝/運行應用程序,然後我得到未定義的錯誤,如果我訪問window.plugins
。
此外,ios.json文件中的平臺/ IOS /不具有插件的任何條目,它就像空:
{
"prepare_queue": {
"installed": [],
"uninstalled": []
},
"config_munge": {
"files": {}
},
"installed_plugins": {},
"dependent_plugins": {}
}
如果我做cordova plugin list
,我可以看到列表在那裏的所有插件。插件的.h和.m文件被複制並存在於平臺/ ios //插件/
這些是我的config.xml文件的內容。
<?xml version='1.1' encoding='utf-8'?>
<widget id="com.myapp.enterprise.prod" version="0.0.50" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>MyApp</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>
<!--
If you do not want any permissions to be added to your app, add the
following tag to your config.xml; you will still have the INTERNET
permission on your app, which PhoneGap requires.
-->
<preference name="permissions" value="none" />
<!-- Customize your app and platform with the preference element. -->
<!-- <preference name="phonegap-version" value="3.4.0" /> -->
<!-- all: current version of PhoneGap -->
<preference name="orientation" value="portrait" />
<!-- all: default means both landscape and portrait are enabled -->
<preference name="target-device" value="universal" />
<!-- all: possible values handset, tablet, or universal -->
<preference name="fullscreen" value="false" />
<!-- all: hides the status bar at the top of the screen -->
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<!-- ios: control whether the screen 'bounces' when scrolled beyond the top -->
<preference name="webviewbounce" value="false" />
<!-- ios: control whether the screen 'bounces' when scrolled beyond the top -->
<preference name="prerendered-icon" value="true" />
<!-- ios: if icon is prerendered, iOS will not apply it's gloss to the app's icon on the user's home screen -->
<preference name="stay-in-webview" value="false" />
<!-- ios: external links should open in the default browser, 'true' would use the webview the app lives in -->
<preference name="ios-statusbarstyle" value="black-opaque" />
<!-- ios: black-translucent will appear black because the PhoneGap webview doesn't go beneath the status bar -->
<preference name="detect-data-types" value="true" />
<!-- ios: controls whether data types (such as phone no. and dates) are automatically turned into links by the system -->
<preference name="exit-on-suspend" value="false" />
<!-- ios: if set to true, app will terminate when home button is pressed -->
<preference name="show-splash-screen-spinner" value="true" />
<!-- ios: if set to false, the spinner won't appear on the splash screen during app loading -->
<preference name="auto-hide-splash-screen" value="true" />
<!-- ios: if set to false, the splash screen must be hidden using a JavaScript API -->
<preference name="disable-cursor" value="false" />
<!-- blackberry: prevents a mouse-icon/cursor from being displayed on the app -->
<preference name="android-minSdkVersion" value="7" />
<!-- android: MIN SDK version supported on the target device. MAX version is blank by default. -->
<preference name="KeyboardShrinksView" value="true" />
<preference name="android-installLocation" value="auto" />
<!-- android: app install location. 'auto' will choose. 'internalOnly' is device memory. 'preferExternal' is SDCard. -->
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name="AndroidLaunchMode" value="singleTask" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="fadeSplashScreenDuration" value="1" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="SplashScreen" value="splash_je" />
<preference name="SplashScreenDelay" value="10000" />
<content src="index.html" />
<access origin="*" />
</widget>
此外,platform/ios /文件夾中沒有cordova_plugins.js文件。
我使用的是Mac OS X(El Capitan),Cordova v5.4.0,Xcode v7.1。
完美,謝謝。這工作。由於沒有代表,我不能滿足您的答案。無論如何,真的很感激。我爲此掙扎了兩天。 –
我相信這已被固定在科爾多瓦5.4.1。還要確保你的插件保存到你可以用'cordova plugin save'完成的config.xml。 – SunshinyDoyle