2015-11-11 4 views
0

У нас есть проект с некоторыми пользовательскими плагинами. Проблема заключается в том, что, когда яФайлы JS Кордовы плагинов не копируются на платформы/папку

cordova build ios 

затем файлы плагинах JS не копируются на платформы/ИОС/WWW/плагинов/, даже если сборка прошла успешно, без каких-либо ошибок, но когда я пытаюсь установить/запустить приложение, тогда я получаю неопределенную ошибку, если я получаю доступ к window.plugins.

Кроме того, ios.json файл в платформы/ИОС/не имеет записей для плагинов, это как пустая:

{ 
    "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> 

Также нет файла cordova_plugins.js в папке platform/ios /.

Я использую Mac OS X (El Capitan), Cordova v5.4.0, Xcode v7.1.

ответ

2

В Cordova 5.4.0 есть bug с плагинами iOS. Попробуйте понизить версию Cordova npm install -g [email protected] или удалить и переустановить плагин (ы) к проекту.

+0

Отлично, спасибо. Это сработало. Я не мог укрепить свой ответ из-за отсутствия репутации. В любом случае, действительно это ценю. Я боролся с ним два дня. –

+0

Я считаю, что это исправлено в Кордове 5.4.1. Также убедитесь, что ваши плагины сохранены в файле config.xml, который вы можете сделать с помощью 'cordova plugin save'. – SunshinyDoyle

Смежные вопросы