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年前的事了,嘤嘤嘤),就把开发任务交给我了,当然也不是我一个人啦,让我组开发小组,说白了,就是让我来 ...
随机推荐
- Java 8 VM GC Tunning Guide Charter 7-8-b
第七章 并发gc Java 8提供两种并发gc,CMS和G1 Concurrent Mark Sweep (CMS) Collector This collector is for applicati ...
- iOS 10的23个隐藏新特性-b
上周iOS 10正式版推送后,24小时的更新率已经超过15%,实在惊人.虽然有着初期变砖.5S6卡顿.移动VoLTE无法使用.美版无信号等BUG,但不可忽视的是,iOS 10还是带来了很多从前没有的功 ...
- as3.0服务端FMS软件常用的方法与属性参考示例
转自:http://www.cuplayer.com/player/PlayerCode/RTMP/2012/0918429.html Application类的方法汇总方法 描述Applicatio ...
- html+css学习笔记 5[表格、表单]
表格 -- 默认样式重置 表格标签: table 表格 thead 表格头 tbody 表格主体 tfoot 表格尾 tr 表格行 th 元素定义表头 ...
- tar命令,转来等用
tar 解压缩命令 tar -c: 建立压缩档案 -x:解压 -t:查看内容 -r:向压缩归档文件末尾追加文件 -u:更新原压缩包中的文件 这五个是独立的命令,压缩解压都要用到其中一个,可以和别的命令 ...
- MyEclipse 2015 Stable 1.0下载安装破解日志
前言 这2天下载了许多myeclipse版本,基本上是14/15版本的,各种破解均告以失败,这次下载了贴吧一个吧友提供的版本,现已破解.破解结果现不好说--目前已装SVN,根据经验,只有等待一定时间验 ...
- 剑指offer--面试题8
题目:求旋转数组中的最小数字 以下为自己所写代码: #include "stdafx.h" #include <iostream> #include <excep ...
- 集合、拆箱、装箱、自定义集合的foreach
集合部分 参考:http://msdn.microsoft.com/zh-cn/library/0ytkdh4s(v=vs.110).aspx 集合类型是诸如哈希表.队列.堆栈.包.字典和列表等数据集 ...
- Asp.Net缓存(2)
缓存页的多个版本 ASP.NET 允许在输出缓存中缓存同一页的多个版本.输出缓存可能会因下列因素而异: 初始请求 (HTTP GET) 中的查询字符串. 回发时传递的控制值(HTTP POST 值). ...
- C++和pascal之间的通信
// MyFirst.cpp : 定义控制台应用程序的入口点.// #include "stdafx.h"#include "Winsock2.h"#pragm ...