将cordova更新到5.4.0版本后,我的应用程序无法运行

将cordova更新到5.4.0版本后,我的应用程序无法运行,cordova,ionic-framework,Cordova,Ionic Framework,我正在创建一个ApacheCordova应用程序(使用Ionic框架),在将Cordova更新到5.4.0之后,我的应用程序无法工作 问题出在我的控制器MyCtrl中。 实际上,我需要等待$ionicPlatform在我的控制器中准备好启动,因此我使用了以下源代码: .controller('MyCtrl', function($scope, $rootScope, $http, $ionicPlatform, $ionicHistory, $cordovaDevice, $cordovaFil

我正在创建一个ApacheCordova应用程序(使用Ionic框架),在将Cordova更新到5.4.0之后,我的应用程序无法工作

问题出在我的控制器MyCtrl中。 实际上,我需要等待$ionicPlatform在我的控制器中准备好启动,因此我使用了以下源代码:

.controller('MyCtrl', function($scope, $rootScope, $http, $ionicPlatform, $ionicHistory, $cordovaDevice, $cordovaFile, $cordovaFileTransfer, $timeout, $interval, $sce, $ionicPopup) {


    $ionicPlatform.ready(function() {
        alert("It's working !");
    });

})
在cordova 5.4.0中,此解决方案不起作用。 没有错误,只是忽略了$ionicPlatform.ready

你能帮我更新我的申请表吗? 也许在控制器中使用$ionicPlatform.ready不是一个好主意,但我不知道其他解决方案

在我的控制器中,我需要使用以下信息:

.controller('MyCtrl', function($scope, $rootScope, $http, $ionicPlatform, $ionicHistory, $cordovaDevice, $cordovaFile, $cordovaFileTransfer, $timeout, $interval, $sce, $ionicPopup) {


    $cordovaDevice.getPlatform(); // can work before $ionicPlatform.ready

    cordova.file.documentsDirectory // can work before $ionicPlatform.ready

    window.requestFileSystem // can work before $ionicPlatform.ready

});
比你强

---编辑2015/11/16:

Cordova版本:5.5.3

爱奥尼亚版本:1.7.7

平台:iOS

IDE:Xcode

警告:没有警告消息

错误:没有错误消息

这是我的config.xml文件:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.test5119111" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" android-versionCode="15" ios-CFBundleVersion="8.4">
  <name>test5</name>
  <!-- <name>テスト</name> -->
  <description>
    テストです。
  </description>
  <author email="kanri@test.com" href="http://test.com/">
    株式会社test
  </author>
  <content src="index.html"/>
  <access origin="*" />

  <preference name="orientation" value="portrait" />
  <preference name="HideKeyboardFormAccessoryBar" value="true" />

  <preference name="AndroidPersistentFileLocation" value="Compatibility" />
  <preference name="iosPersistentFileLocation" value="Library" />
  <preference name="iosPersistentFileLocation" value="Compatibility" />

  <feature name="File">
      <param name="ios-package" value="CDVFile" />
  </feature>

  <feature name="FileTransfer">
      <param name="ios-package" value="CDVFileTransfer" />
  </feature>

  <preference name="AllowInlineMediaPlayback" value="true"/>

  <preference name="DisallowOverscroll" value="true" />
  <preference name="UIWebViewBounce" value="false" />

  <preference name="android-minSdkVersion" value="14" />

  <feature name="Device">
    <param name="android-package" value="org.apache.cordova.Device" />
  </feature>

  <preference name="webviewbounce" value="false"/>
  <preference name="UIWebViewBounce" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="android-minSdkVersion" value="16"/>
  <preference name="BackupWebStorage" value="none"/>
  <preference name="SplashScreen" value="screen"/>
  <preference name="SplashScreenDelay" value="3000"/>
  <feature name="StatusBar">
    <param name="ios-package" value="CDVStatusBar" onload="true"/>
  </feature>
  <platform name="ios">
    <icon src="resources/ios/icon/icon.png" width="57" height="57"/>
    <icon src="resources/ios/icon/icon@2x.png" width="114" height="114"/>
    <icon src="resources/ios/icon/icon-40.png" width="40" height="40"/>
    <icon src="resources/ios/icon/icon-40@2x.png" width="80" height="80"/>
    <icon src="resources/ios/icon/icon-50.png" width="50" height="50"/>
    <icon src="resources/ios/icon/icon-50@2x.png" width="100" height="100"/>
    <icon src="resources/ios/icon/icon-60.png" width="60" height="60"/>
    <icon src="resources/ios/icon/icon-60@2x.png" width="120" height="120"/>
    <icon src="resources/ios/icon/icon-60@3x.png" width="180" height="180"/>
    <icon src="resources/ios/icon/icon-72.png" width="72" height="72"/>
    <icon src="resources/ios/icon/icon-72@2x.png" width="144" height="144"/>
    <icon src="resources/ios/icon/icon-76.png" width="76" height="76"/>
    <icon src="resources/ios/icon/icon-76@2x.png" width="152" height="152"/>
    <icon src="resources/ios/icon/icon-small.png" width="29" height="29"/>
    <icon src="resources/ios/icon/icon-small@2x.png" width="58" height="58"/>
    <icon src="resources/ios/icon/icon-small@3x.png" width="87" height="87"/>
    <icon src="resources/ios/icon/iTunesArtwork" width="512" height="512"/>
    <icon src="resources/ios/icon/iTunesArtwork@2x" width="1024" height="1024"/>
    <splash src="resources/ios/splash/Default-568h@2x~iphone.png" height="1136" width="640"/>
    <splash src="resources/ios/splash/Default-667h.png" height="1334" width="750"/>
    <splash src="resources/ios/splash/Default-736h.png" height="2208" width="1242"/>
    <splash src="resources/ios/splash/Default-Landscape-736h.png" height="1242" width="2208"/>
    <splash src="resources/ios/splash/Default-Landscape@2x~ipad.png" height="1536" width="2048"/>
    <splash src="resources/ios/splash/Default-Landscape~ipad.png" height="768" width="1024"/>
    <splash src="resources/ios/splash/Default-Portrait@2x~ipad.png" height="2048" width="1536"/>
    <splash src="resources/ios/splash/Default-Portrait~ipad.png" height="1024" width="768"/>
    <splash src="resources/ios/splash/Default@2x~iphone.png" height="960" width="640"/>
    <splash src="resources/ios/splash/Default~iphone.png" height="480" width="320"/>
  </platform>
  <platform name="android">
    <icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
    <icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
    <icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
    <icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
    <icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
    <icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
    <splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/>
    <splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/>
    <splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/>
    <splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
    <splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
    <splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
    <splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
    <splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
    <splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
    <splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
    <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
    <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
  </platform>
</widget>

测试5
テストです。
株式会社测试
@Officebit,
谢谢你回答问题。大多数开发人员使用Cordova/Phonegap CLi或Phonegap构建。这使你的答案有点独特

使用您的
config.xml
,因为您说您是为
iOS
构建的,所以我删除了所有其他不适用的东西(即Android和Windows)。您的
config.xml
中有很多错误。您应该会因此收到错误,但我不熟悉您的IDE

接下来,由于苹果的
ATS
系统,您应该会遇到网络错误。ATS正在阻止您的网络访问。(如何在一分钟内修复)您应该已经遇到了
ATS
;我无法100%确定您为什么还没有遇到
ATS
。这可能是因为您的javascript没有启动

此外,我将假设您正在本地加载所有资产(Javascript、CSS等),而不是从Internet加载

你应该做三(3)件事

  • 您需要查看我正在发布的
    config.xml
    并对其进行更改
  • 您需要应用
    白名单
    系统,其中包括
    CSP
    ATS
  • 在业余时间,你应该阅读以下内容:
  • 修复 1<下面是code>config.xml

    2 3.在业余时间,你应该阅读以下内容:

    • -这会出现在您的
      index.html
      中。
      
      
    • -这会出现在您的
      Info.plist
      中。
      
      NSAppTransportSecurity
      NSAllowsArbitraryLoads
      
    忽略这一行

    
    测试5
    テストです。
    株式会社测试
    
    我确认! 此代码不适用于cordova 5.4.0,但适用于最新版本(示例:cordova 5.3.3):


    是否使用以前版本的Cordova?目标平台?请发布您的
    config.xml
    @JesseMonroy650,谢谢您的回复。我编辑我的帖子你在
    config.xml
    中有很多错误。你没有回答我的问题。请帮助我了解你的应用程序。你说“更新后(…)不起作用”,你使用的Cordova的前一个版本是什么?你的目标平台是什么?iOS,安卓,Windows,黑莓,其他?您是否使用IDE(Android Studio、Visual Studio、Eclipse)?您使用的是SDK还是CLI?若你们不明白我在说什么,问问题。我在哪里可以报告cordova平台的错误?有网页吗?谢谢@JesseMonroy650:平台是iOS/Cordova版本是5.5.3/I使用Xcode
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <widget id="com.ionicframework.test5119111" 
        version="0.0.1" xmlns="http://www.w3.org/ns/widgets"
        xmlns:cdv="http://cordova.apache.org/ns/1.0"
        android-versionCode="15" ios-CFBundleVersion="8.4" />
      <name>test5</name>
      <!-- <name>テスト</name> -->
      <description>
        テストです。
      </description>
      <author email="kanri@test.com" href="http://test.com/">
        株式会社test
      </author>
      <content src="index.html"/>
    
      <!-- These are okay -->
      <preference name="orientation" value="portrait" />
      <preference name="HideKeyboardFormAccessoryBar" value="true" />
      <preference name="AllowInlineMediaPlayback" value="true"/>
      <preference name="DisallowOverscroll" value="true" />
      <preference name="DisallowOverscroll" value="true"/>
      <preference name="BackupWebStorage" value="none"/>
    
      <!-- These paramters are deprecated consider using 
           the plugin [cordova-plugin-splashscreen]
           (https://www.npmjs.com/package/cordova-plugin-splashscreen).
           It has different parameters.
       -->
      <preference name="SplashScreen" value="screen"/>
      <preference name="SplashScreenDelay" value="3000"/>
    
      <!-- 'UIWebViewBounce' is deprecated. Use 'DisallowOverscroll' instead.
           https://github.com/phonegap/build/issues/131
           You need to make the change.
       -->
      <preference name="webviewbounce" value="false"/>
      <preference name="UIWebViewBounce" value="false" />
    
      <!-- I assume this is for the `File` plugin. -->
      <preference name="iosPersistentFileLocation" value="Library" />
      <preference name="iosPersistentFileLocation" value="Compatibility" />
    
      <feature name="File">
          <param name="ios-package" value="CDVFile" />
      </feature>
      <feature name="FileTransfer">
          <param name="ios-package" value="CDVFileTransfer" />
      </feature>
      <feature name="StatusBar">
        <param name="ios-package" value="CDVStatusBar" onload="true"/>
      </feature>
    
      <platform name="ios">
        <icon src="resources/ios/icon/icon.png" width="57" height="57"/>
        <icon src="resources/ios/icon/icon@2x.png" width="114" height="114"/>
        <icon src="resources/ios/icon/icon-40.png" width="40" height="40"/>
        <icon src="resources/ios/icon/icon-40@2x.png" width="80" height="80"/>
        <icon src="resources/ios/icon/icon-50.png" width="50" height="50"/>
        <icon src="resources/ios/icon/icon-50@2x.png" width="100" height="100"/>
        <icon src="resources/ios/icon/icon-60.png" width="60" height="60"/>
        <icon src="resources/ios/icon/icon-60@2x.png" width="120" height="120"/>
        <icon src="resources/ios/icon/icon-60@3x.png" width="180" height="180"/>
        <icon src="resources/ios/icon/icon-72.png" width="72" height="72"/>
        <icon src="resources/ios/icon/icon-72@2x.png" width="144" height="144"/>
        <icon src="resources/ios/icon/icon-76.png" width="76" height="76"/>
        <icon src="resources/ios/icon/icon-76@2x.png" width="152" height="152"/>
        <icon src="resources/ios/icon/icon-small.png" width="29" height="29"/>
        <icon src="resources/ios/icon/icon-small@2x.png" width="58" height="58"/>
        <icon src="resources/ios/icon/icon-small@3x.png" width="87" height="87"/>
        <icon src="resources/ios/icon/iTunesArtwork" width="512" height="512"/>
        <icon src="resources/ios/icon/iTunesArtwork@2x" width="1024" height="1024"/>
        <splash src="resources/ios/splash/Default-568h@2x~iphone.png" height="1136" width="640"/>
        <splash src="resources/ios/splash/Default-667h.png" height="1334" width="750"/>
        <splash src="resources/ios/splash/Default-736h.png" height="2208" width="1242"/>
        <splash src="resources/ios/splash/Default-Landscape-736h.png" height="1242" width="2208"/>
        <splash src="resources/ios/splash/Default-Landscape@2x~ipad.png" height="1536" width="2048"/>
        <splash src="resources/ios/splash/Default-Landscape~ipad.png" height="768" width="1024"/>
        <splash src="resources/ios/splash/Default-Portrait@2x~ipad.png" height="2048" width="1536"/>
        <splash src="resources/ios/splash/Default-Portrait~ipad.png" height="1024" width="768"/>
        <splash src="resources/ios/splash/Default@2x~iphone.png" height="960" width="640"/>
        <splash src="resources/ios/splash/Default~iphone.png" height="480" width="320"/>
      </platform>
      <access origin="*" />
    </widget>
    
    angular.module('PlatformApp', ['ionic'])
    .controller('PlatformCtrl', function($scope) {
    
      ionic.Platform.ready(function(){
        alert("It's ok!");
      });
    
    });