Phonegap:CLI升级到6.5.0后,iOS错误

时间:2018-12-10 21:13:03

标签: phonegap

我已根据截至2018年12月1日的Adobe build cloud service的新指南将可运行的Phonegap应用程序从CLI版本6.1.0升级到6.5.0。 自从我升级到CLI版本6.5.0以来,我的应用程序的iOS版本遇到了一个新错误。在应用启动之后,活动动画仍然可见,而不是加载应用的登录页面。在版本6.1.0中,用户将暴露于位置许可弹出窗口,而CLI 6.5.0并未显示该窗口。相反,在iPhone上单击“主页”按钮后,我看到该权限在应用程序外部弹出。无论我在弹出窗口中选择什么,返回到应用程序时,登录屏幕都将完全加载。 这是我当前的config.xml。我基本上只是将电话间隔版本条目从“ cli-6.1.0”更改为“ cli-6.5.0”。

<?xml version='1.0' encoding='utf-8'?>
<widget xmlns="http://www.w3.org/ns/widgets" 
        xmlns:gap="http://phonegap.com/ns/1.0" 
        xmlns:android="http://schemas.android.com/apk/res/android"
        id=„foo“ 
        version=„1.1“ versionCode="90">

    <gap:config-file platform="ios" parent="CFBundleShortVersionString"> 
        <string>1.1</string>
    </gap:config-file>

    <name>foo</name>

    <description>
        foo
    </description>

    <author email=„foo“ href=„foo“>
        foo
    </author>

    <gap:platform name="ios" />
    <gap:platform name="android" />

    <preference name="permissions" value="none" />
    <preference name="phonegap-version" value="cli-6.5.0" />
    <preference name="orientation" value="portrait" />
    <preference name="fullscreen" value="false" />
    <preference name="target-device" value="handset" />
    <preference name="webviewbounce" value="false" />
    <preference name="prerendered-icon" value="true" />
    <preference name="stay-in-webview" value="false" />
    <preference name="ios-statusbarstyle" value="black-opaque" />
    <preference name="detect-data-types" value="true" />
    <preference name="exit-on-suspend" value="false" />
    <preference name="show-splash-screen-spinner" value="false" />
    <preference name="auto-hide-splash-screen" value="false" />
    <preference name="disable-cursor" value="false" />
    <preference name="android-minSdkVersion" value="15" />
    <preference name="android-installLocation" value="auto" />
    <preference name="EnableViewportScale" value="true" />
    <preference name="KeyboardDisplayRequiresUserAction" value="false" />
    <preference name="HideKeyboardFormAccessoryBar" value="false" />
    <preference name="SuppressesIncrementalRendering" value="false" />
    <preference name="StatusBarOverlaysWebView" value="false" />
    <preference name="StatusBarBackgroundColor" value="#000000" />
    <preference name="KeepRunning" value="true"/>

    <gap:config-file platform="android" parent="/manifest/application">
        <activity android:launchMode="singleTask" />
    </gap:config-file>

    <gap:config-file platform="ios" parent="UIBackgroundModes" overwrite="true">
        <array>
            <string>location</string>
        </array>
    </gap:config-file>

    <gap:config-file platform="ios" parent="LSApplicationQueriesSchemes" overwrite="true">
        <array>
            <string>comgooglemaps</string>
            <string>tomtomhome</string>
            <string>navigon</string>
        </array>
    </gap:config-file>

    <gap:config-file platform="ios" parent="NSLocationAlwaysUsageDescription"> 
        <string>foo</string> 
    </gap:config-file>

    <gap:config-file platform="ios" parent="NSLocationWhenInUseUsageDescription"> 
        <string>foo</string> 
    </gap:config-file>

    <gap:config-file platform="ios" parent="NSMotionUsageDescription"> 
        <string>foo</string> 
    </gap:config-file> 

    <gap:config-file platform="ios" parent="NSPhotoLibraryUsageDescription">  
      <string>foo</string> 
    </gap:config-file> 

    <icon src="icon.png" />
    <icon gap:density="ldpi" gap:platform="android" src="res/icons/android/ldpi.png" />
    <icon gap:density="mdpi" gap:platform="android" src="res/icons/android/mdpi.png" />
    <icon gap:density="hdpi" gap:platform="android" src="res/icons/android/hdpi.png" />
    <icon gap:density="xhdpi" gap:platform="android" src="res/icons/android/xhdpi.png" />

    <icon gap:platform="ios" height="40" src="res/icons/ios/icon-40.png" width="40" />
    <icon gap:platform="ios" height="80" src="res/icons/ios/icon-40@2x.png" width="80" />

    <icon gap:platform="ios" height="1024" src="res/icons/ios/icon.png" width="1024" />
    <icon gap:platform="ios" height="57" src="res/icons/ios/icon_57_57.png" width="57" />
    <icon gap:platform="ios" height="58" src="res/icons/ios/icon_58_58.png" width="58" />
    <icon gap:platform="ios" height="87" src="res/icons/ios/icon_87_87.png" width="87" />
    <icon gap:platform="ios" height="114" src="res/icons/ios/icon_at_2x.png" width="114" />
    <icon gap:platform="ios" height="120" src="res/icons/ios/icon-40@3x.png" width="120" />

    <gap:splash src="splash.png" />
    <gap:splash gap:platform="android" src="res/splash/android/ldpi.png" gap:density="ldpi" />
    <gap:splash gap:platform="android" src="res/splash/android/mdpi.png" gap:density="mdpi" />
    <gap:splash gap:platform="android" src="res/splash/android/hdpi.png" gap:density="hdpi" />
    <gap:splash gap:platform="android" src="res/splash/android/xhdpi.png" gap:density="xhdpi" />

    <platform name="ios">
        <splash src="res/splash/ios/Default.png" width="320" height="480" />
        <splash src="res/splash/ios/Default_at_2x.png" width="640" height="960" />
        <splash src="res/splash/ios/Default_iphone5.png" width="640" height="1136" />
        <splash src="res/splash/ios/Default_iphone6.png" width="750" height="1334" />
        <splash src="res/splash/ios/Default_iphone6_at3x.png" width="1242" height="2208" />
    </platform>

    <gap:splash gap:platform="ios" src="res/splash/ios/Default.png" width="320" height="480" />
    <gap:splash gap:platform="ios" src="res/splash/ios/Default_at_2x.png" width="640" height="960" />
    <gap:splash gap:platform="ios" src="res/splash/ios/Default_iphone5.png" width="640" height="1136" />
    <gap:splash gap:platform="ios" src="res/splash/ios/Default_iphone6.png" width="750" height="1334" />
    <gap:splash gap:platform="ios" src="res/splash/ios/Default_iphone6_at3x.png" width="1242" height="2208" /> 

    <access origin="*" />
    <allow-navigation href="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>

    <preference name="android-build-tool" value="gradle" />

    <plugin source="npm" name="cordova-plugin-camera" spec="2.2.0" />

    <plugin source="npm" name="cordova-plugin-whitelist" spec="1.2.1" />
    <plugin source="npm" name="cordova-plugin-device" spec="1.1.1" />

    <plugin source="npm" name="cordova-plugin-file" spec="3.0.0" />
    <plugin source="npm" name="cordova-plugin-file-transfer" spec="1.3.0" />
    <plugin source="npm" name="cordova-plugin-network-information" spec="1.0.1" />

    <plugin source="npm" name="cordova-plugin-splashscreen" spec="2.1.0" />
    <plugin source="npm" name="cordova-plugin-statusbar" spec="2.1.1" />
    <plugin source="npm" name="cordova-plugin-geolocation" spec="2.1.0" />

    <plugin name="https://github.com/ohh2ahh/AppAvailability.git#v0.3.1" />
    <plugin name="https://github.com/interFace-dk/phonegap-googlenavigate.git" />
    <plugin name="https://github.com/kdileep1990/com.dileep.plugins.datepicker.git#0.0.1" />
    <plugin name="https://github.com/cmackay/google-analytics-plugin.git#v1.0.2" />

    <preference name="cordova-background-geolocation-license" value=„123“ />
    <plugin name="background-geolocation" spec="1.7.3" source="pgb" />
      <plugin name="https://github.com/katzer/cordova-plugin-app-event.git#1.2.0" />
      <plugin name="https://github.com/cliqueApp/cordova-plugin-local-notifications.git#master" />

    <plugin source="npm" name="phonegap-plugin-push" spec="1.7.2">
        <param name="SENDER_ID" value=„123“ />
    </plugin>

</widget>

我怀疑,使用新的CLI版本调用NSLocation的方式存在问题。 版本更改为6.5.0还会引起其他重要变化吗?任何提示将不胜感激。

1 个答案:

答案 0 :(得分:0)

我找到了问题here的解决方案。长话短说,这就是我解决此问题的方法: -config.xml(更改了版本号,我使用了较旧的版本):

bootstrap.php
  • index.html(添加了这一行):

<plugin name="cordova-plugin-geolocation" spec="2.4.3" />

玩得开心。