Ionic2:Ion Infinite卷轴无法在iPhone中运行

时间:2017-03-30 09:22:28

标签: javascript angular typescript ionic2

我在Ionic 2框架中面临无限滚动的问题,它适用于Android,但对于Iphone却没有,请帮助...

离子信息:

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:

"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中提供不同

  • 谷歌之后我发现它可能是离子版本2.3.0的问题,并试图降级它,但我无法在Mac上这样做。为此,我在ion-angular中更改了package.json。

请帮忙

当我尝试npm安装时,请关注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-b​​rowser @ 2.4.8的同行,但没有安装。 npm WARN ionic-angular@2.3.0需要@ angular / platform-b​​rowser-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需要一个zone.js@0.7.2的对等体,但没有安装。

2 个答案:

答案 0 :(得分:0)

此问题已在3.0.1版本中修复。但是,不在离子3.0.0

答案 1 :(得分:0)

确保安装了最新的Cordova CLI :(可能需要Sudo)

public static void main(String[] args) 
{
    int[] Array= {5,4,6,3,7,2,8,1,9,0};
    int max=0;
    System.out.println(maximum(Array,Array.length-1,max));
}

public static int maximum(int[] Array,int length,int max)
{
    if (length!=0)
    {
        if(max<Array[length])
        {
            max=Array[length];
        }

        maximum(Array,length-1,max); 
    }

    return max;  
}

确保已添加ios平台:

npm install cordova -g

如果未列出iOS平台,请运行以下命令:

ionic platform ls

如果安装了iOS平台,但版本是&lt; 4.x,运行以下命令:

ionic platform add ios

安装WKWebViewPlugin:

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

构建平台:

ionic plugin add https://github.com/driftyco/cordova-plugin-wkwebview-engine.git --save

在iOS 9或10设备上测试应用程序:

ionic prepare

验证是否已在iOS上安装WKWebView的简单方法是检查window.indexedDB是否存在。例如:

ionic run ios

必需的权限

WKWebView可能无法完全启动(deviceready事件可能无法触发),除非config.xml中包含以下内容:

config.xml中

if (window.indexedDB) {
   console.log("I'm in WKWebView!"); 
} else {
   console.log("I'm in UIWebView");
}