Ionic开发中常见问题和解决方案记录
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);
});
Ionic开发中常见问题和解决方案记录的更多相关文章
- ionic开发中,输入法键盘弹出遮挡住div元素
采用ionic 开发中,遇到键盘弹出遮挡元素的问题. 以登陆页面为例,输入用户名和密码时,键盘遮挡了登陆按钮. 最终采用自定义指令解决了问题: .directive('popupKeyBoardSho ...
- react + antiDesign开发中遇到的问题记录
react + antiDesign开发中遇到的问题记录 一:页面中子路由失效: antiDesign的官方实例中,会把路由重复的地方给去重,而且路由匹配模式不是严格模式.所以我们需要在util.js ...
- iOS开发中常见问题集锦
在iOS开发中,会出现各种各样的问题.今天,就把这些常见的问题以及各位大牛的解决方案汇总下,方便以后查阅: 常见错误: 1. linker command failed with exit code ...
- Android Studio使用过程中常见问题及解决方案
熟悉Android的童鞋应该对Android Studio都不陌生.Android编程有两个常用的开发环境,分别是Android Studio和Eclipse,之前使用比较多的是Eclipse,而现在 ...
- 关于ionic开发中遇到的坑与总结
这次是第二次使用ionic开发混合app,今天算是对这个框架做一个总结,基础的我就不再重复了,网上都有教程.我就说说自己的心得和遇见的各种坑, 之后会陆续补充,想到什么说什么吧. 1.关于ionic效 ...
- 开发中的一些解决方案(c#)
1.如果需要配置文件,不妨考虑用XML序列化技术实现XML配置文件.在C#中引入System.Xml.Serialization命名空间,编写实体类序列化到XML文件中(或反序列化到对象),编写少量代 ...
- SAP HANA开发中常见问题- 基于SAP HANA平台的多团队产品研发
大家都知道SAP HANA项目打包成Delivery Unit(缩写为DU).依照"官方"的开发模式,特别是整个团队仅仅使用一个HANA Instance进行项目开发,因为HANA ...
- 个人理解---在开发中何时加入日志记录功能[java]
是这样的:俩个月前做的一个小功能,今天经理突然问我这个'清除复投记录'功能是不是我做的,我说是,很久以前了.他说昨天一个客户找过来了,后台把人家的复投记录清除掉了,不知道何时清除的,我记得当时做的时候 ...
- Android开发中常见问题分析及解决
最近公司有新的业务需求,需要开发一款APP,因为我开发过Android APP(我想告诉他们,那是4年前的事了,嘤嘤嘤),就把开发任务交给我了,当然也不是我一个人啦,让我组开发小组,说白了,就是让我来 ...
随机推荐
- android开发获取屏幕高度和宽度
宽度:getWindowManager().getDefaultDisplay().getWidth(); 高度:getWindowManager().getDefaultDisplay().getH ...
- [转载+原创]Emgu CV on C# (四) —— Emgu CV on 全局固定阈值二值化
重点介绍了全局二值化原理及数学实现,并利用emgucv方法编程实现. 一.理论概述(转载,如果懂图像处理,可以略过,仅用作科普,或者写文章凑字数) 1.概述 图像二值化是图像处理中的一项基本技术,也 ...
- DataTable.Compute 性能慢的问题
问题描述 工作中碰到一个dt.Compute("max(lineid)","")来取最大行号的情况,由于dt中数据大概有4000条,发现每次调用需要0.3秒的耗 ...
- win8 telnet VirtualBox中的redhat9
1. VirtualBox设置网络连接为“桥接网卡”,并且此网卡要为win8正在使用的网卡(比如我的电脑上使用的就是无线网卡,则选择网卡时也要用无线网卡) 2. 在redhat的终端里,运行ifcon ...
- Codeforces Round #352 (Div. 2) D. Robin Hood
题目链接: http://codeforces.com/contest/672/problem/D 题意: 给你一个数组,每次操作,最大数减一,最小数加一,如果最大数减一之后比最小数加一之后要小,则取 ...
- 浅谈Feature Scaling
浅谈Feature Scaling 定义:Feature scaling is a method used to standardize the range of independent variab ...
- 如何深入理解 StatsD 与 Graphite ?
众所周知,StatsD 负责收集并聚合测量值.之后,它会将数据传给 Graphite,后者以时间序列为依据存储数据,并绘制图表.但是,我们不知道,基于 http 访问的图表在展示时,是基于每秒钟的请求 ...
- gulp-css-spriter 雪碧图合成
一.配置 gulp的雪碧图功能没有grunt那么强大,但是类似功能也支持,功能稍微弱一些,但是也很棒 npm地址:https://www.npmjs.com/package/gulp-css-spri ...
- hdu 3123 GCC
这题分2种情况: 1) n>=m时,k!%m=0(k>=m),所以只需令n=m-1即可: 2) n<m时,正常情况处理即可. ;}
- [2-sat]HDOJ1824 Let's go home
中问题 题意略 和HDOJ 3062一样 这里 每个队员都有 选 和 不选 两种, 即 上篇所说的$x$和$x’$ 建图:队长(a)留下或者其余两名队员(b.c)同时留下 那么就是$a' \Right ...