Cordova 插件的 JS 文件未复制到平台/文件夹
Cordova plugin's JS files not being copied to platforms/ folder
我们有一个包含一些自定义插件的项目。问题是当我做
cordova build ios
然后插件的 JS 文件不会复制到 platforms/ios/www/plugins/,即使构建成功且没有任何错误,但是当我尝试 install/run 应用程序,然后如果我访问 window.plugins
.
,我会收到未定义的错误
此外,ios.json 文件在 platforms/ios/ 中没有任何插件条目,就像空的:
{
"prepare_queue": {
"installed": [],
"uninstalled": []
},
"config_munge": {
"files": {}
},
"installed_plugins": {},
"dependent_plugins": {}
}
如果我这样做 cordova plugin list
,我可以在那里看到所有插件的列表。插件的 .h 和 .m 文件也被复制并存在于 platforms/ios//Plugins/
这些是我的 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="dev@cordova.apache.org" 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>
platforms/ios/ 文件夹中也没有 cordova_plugins.js 文件。
我正在使用 Mac OS X (El Capitan), Cordova v5.4.0, Xcode v7.1.
Cordova 5.4.0 中有一个带有 iOS 插件的 bug。尝试降级 Cordova npm install -g cordova@5.3.3
或删除并重新安装您的插件到项目。
我们有一个包含一些自定义插件的项目。问题是当我做
cordova build ios
然后插件的 JS 文件不会复制到 platforms/ios/www/plugins/,即使构建成功且没有任何错误,但是当我尝试 install/run 应用程序,然后如果我访问 window.plugins
.
此外,ios.json 文件在 platforms/ios/ 中没有任何插件条目,就像空的:
{
"prepare_queue": {
"installed": [],
"uninstalled": []
},
"config_munge": {
"files": {}
},
"installed_plugins": {},
"dependent_plugins": {}
}
如果我这样做 cordova plugin list
,我可以在那里看到所有插件的列表。插件的 .h 和 .m 文件也被复制并存在于 platforms/ios//Plugins/
这些是我的 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="dev@cordova.apache.org" 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>
platforms/ios/ 文件夹中也没有 cordova_plugins.js 文件。
我正在使用 Mac OS X (El Capitan), Cordova v5.4.0, Xcode v7.1.
Cordova 5.4.0 中有一个带有 iOS 插件的 bug。尝试降级 Cordova npm install -g cordova@5.3.3
或删除并重新安装您的插件到项目。