Ionic2:Ion Infinite卷轴无法在iPhone中运行 [英] Ionic2: Ion Infinite scroller not working in iPhone
问题描述
我在Ionic 2框架中面临无限滚动的问题,它适用于Android,但对于Iphone它没有,请帮助...
I am facing an issue with infinite scroll in Ionic 2 framework, it works perfectly for Android but for Iphone its not, any help please ...
离子信息:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.0
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.9.4
Xcode version: Xcode 8.2.1 Build version 8C1002
这是我的package.json:
This is my package.json:
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/compiler-cli": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/platform-server": "2.2.1",
"@ionic/storage": "1.1.6",
"ionic-angular": "^2.0.0-rc.4",
"ionic-native": "2.2.11",
"ionicons": "3.0.0",
"moment": "^2.17.1",
"mydatepicker": "^1.1.1",
"ng2-translate": "^4.0.1",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26",
"sw-toolbox": "3.4.0"
},
"devDependencies": {
"@ionic/app-scripts": "1.0.0",
"angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^3.0.0-beta.18",
"typescript": "2.0.6"
},
-
问题是这也是我从哪里来的我正在获得离子框架版本2.3.0,而我在package.json中给出了不同的颜色
Question is this also that from where i am getting ionic-framework version 2.3.0 whereas i am giving different in package.json
google后我发现它可能是离子版本2.3的问题.0并试图降级它,但我无法在Mac上这样做。为此,我在离子角度中更改了package.json。
After google i found that it can be a issue of ionic version 2.3.0 and tried to downgrade it but i am unable to do so on mac. To do so i changes in package.json in ion-angular.
请帮助
当我尝试npm安装得到以下erorr:
When i am trying npm install getting following erorr:
npm WARN ionic-angular@2.3.0 requires a peer of @angular/common@2.4.8 but none was installed.
npm WARN ionic-angular@2.3.0需要@ angular / compiler @ 2.4.8的同伴但没有安装。
npm WARN ionic-angular@2.3.0需要@ angular / compiler-cli @ 2.4.8的对等体,但没有安装。
npm WARN ionic-angular@2.3.0需要@ angular / core @ 2.4.8的同行,但没有安装。
npm WARN ionic-angular@2.3.0需要@ angular / forms @ 2.4.8的同行,但没有安装。
npm WARN ionic-angular@2.3.0需要@ angular / http @ 2.4.8的同伴,但没有安装。
npm WARN ionic-angular@2.3.0需要@ angular / platform-browser @ 2.4.8的同行,但没有安装。
npm WARN ionic-angular@2.3.0需要@ angular / platform-browser-dynamic @ 2.4.8的同行,但没有安装。
npm WARN ionic-angular@2.3.0需要@ angular / platform-server @ 2.4.8的对等,但没有安装。
npm WARN ionic-angular@2.3.0需要rxjs@5.0.1的对等体,但没有安装。
npm WARN ionic-angular@2.3.0需要一个peer.js@0.7.2的同行,但没有安装。npm WARN ionic-angular@2.3.0 requires a peer of @angular/compiler@2.4.8 but none was installed. npm WARN ionic-angular@2.3.0 requires a peer of @angular/compiler-cli@2.4.8 but none was installed. npm WARN ionic-angular@2.3.0 requires a peer of @angular/core@2.4.8 but none was installed. npm WARN ionic-angular@2.3.0 requires a peer of @angular/forms@2.4.8 but none was installed. npm WARN ionic-angular@2.3.0 requires a peer of @angular/http@2.4.8 but none was installed. npm WARN ionic-angular@2.3.0 requires a peer of @angular/platform-browser@2.4.8 but none was installed. npm WARN ionic-angular@2.3.0 requires a peer of @angular/platform-browser-dynamic@2.4.8 but none was installed. npm WARN ionic-angular@2.3.0 requires a peer of @angular/platform-server@2.4.8 but none was installed. npm WARN ionic-angular@2.3.0 requires a peer of rxjs@5.0.1 but none was installed. npm WARN ionic-angular@2.3.0 requires a peer of zone.js@0.7.2 but none was installed.
推荐答案
确保安装了最新的Cordova CLI :(可能需要Sudo)
Ensure the latest Cordova CLI is installed: (Sudo may be required)
npm install cordova -g
确保已添加ios平台:
Ensure the ios platform has been added:
ionic platform ls
如果未列出iOS平台,请运行以下命令:
If the iOS platform is not listed, run the following command:
ionic platform add ios
如果安装了iOS平台,但版本是< 4.x,运行以下命令:
If the iOS platform is installed but the version is < 4.x, run the following commands:
ionic platform update ios ionic plugin save # creates backup of existing plugins rm -rf ./plugins # delete plugins directory ionic prepare # re-install plugins compatible with cordova-ios 4.x
安装WKWebViewPlugin:
Install the WKWebViewPlugin:
ionic plugin add https://github.com/driftyco/cordova-plugin-wkwebview-engine.git --save
建立平台:
ionic prepare
在iOS 9或10设备上测试应用程序:
Test the app on an iOS 9 or 10 device:
ionic run ios
验证在iOS上安装WKWebView的一种简单方法是检查window.indexedDB是否存在。例如:
An easy way to verify that WKWebView has been installed on iOS is to check if window.indexedDB exists. For example:
if (window.indexedDB) { console.log("I'm in WKWebView!"); } else { console.log("I'm in UIWebView"); }
所需权限
WKWebView可能无法完全启动(deviceready事件可能无法触发),除非config.xml中包含以下内容:
WKWebView may not fully launch (the deviceready event may not fire) unless if the following is included in config.xml:
config.xml
config.xml
<allow-navigation href="http://localhost:8080/*"/> <feature name="CDVWKWebViewEngine"> <param name="ios-package" value="CDVWKWebViewEngine" /> </feature> <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
这篇关于Ionic2:Ion Infinite卷轴无法在iPhone中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!