1npm按裝包失敗
更換源:npm config set registry https://registry.npm.taobao.org
或者使用cnpm
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
2.ionic真機調試
ionic run android --livereload -c -s
3.ionic run ios 報錯
sudo npm install -g ios-deploy --unsafe-perm=true
4.跨域(這個問題在android上有,請求發不出去)
cordova plugin add cordova-plugin-whitelist
5.google跨域插件:
Access-Control-Allow-Origin
6.更改statusbar顏色
cordova plugin add cordova-plugin-statusbar
7.ionic生成圖標資源
准備好icon.png 和splash.png
ionic resources
8.解決android tabs的布局調到底部,和iOS一致
$ionicConfigProvider.tabs.position('bottom');
9.android錄制屏幕:
adb shell screenrecord /sdcard/video/littleQ.mp4 命令錄制
問題:
Using this version of Cordova with older version of cordova-android is being deprecated. Consider upgrading to cordova-android@5.0.0 ro newer
刪除platforms對應的平台,重新platform add [platform]
ionic build android : Unable to start the daemon process error
在用戶文件夾中找到.gradle文件夾,新增gradle.properties文件,內容如下:
org.gradle.jvmargs=-Xmx512m
ionic跨域問題,在接口端加上:
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
$timeout(function () { //return false; // <--- comment this to "fix" the problem var sv = $ionicScrollDelegate.$getByHandle('horizontalScroll').getScrollView(); var container = sv.__container; var originaltouchStart = sv.touchStart; var originalmouseDown = sv.mouseDown; var originaltouchMove = sv.touchMove; var originalmouseMove = sv.mouseMove; container.removeEventListener('touchstart', sv.touchStart); container.removeEventListener('mousedown', sv.mouseDown); document.removeEventListener('touchmove', sv.touchMove); document.removeEventListener('mousemove', sv.mousemove); sv.touchStart = function (e) { e.preventDefault = function () { } if (originalmouseMove) { originaltouchStart.apply(sv, [e]); } } sv.touchMove = function (e) { e.preventDefault = function () { } if (originalmouseMove) { originaltouchMove.apply(sv, [e]); } } sv.mouseDown = function (e) { e.preventDefault = function () { } if (originalmouseMove) { originalmouseDown.apply(sv, [e]); } } sv.mouseMove = function (e) { e.preventDefault = function () { } if (originalmouseMove) { originalmouseMove.apply(sv, [e]); } } container.addEventListener("touchstart", sv.touchStart, false); container.addEventListener("mousedown", sv.mouseDown, false); document.addEventListener("touchmove", sv.touchMove, false); document.addEventListener("mousemove", sv.mouseMove, false); });
