心有思

学而不思则罔,思而不学则殆


  • 首页

  • 分类

  • 归档

  • 标签

  • 搜索

iOS崩溃信号速查

发表于 2017-07-24 | 分类于 ios
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt */
#define SIGQUIT 3 /* quit */
#define SIGILL 4 /* illegal instruction (not reset when caught) */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGABRT 6 /* abort() */
#if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE))
#define SIGPOLL 7 /* pollable event ([XSR] generated, not supported) */
#else /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
#define SIGIOT SIGABRT /* compatibility */
#define SIGEMT 7 /* EMT instruction */
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGBUS 10 /* bus error */
#define SIGSEGV 11 /* segmentation violation */
#define SIGSYS 12 /* bad argument to system call */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#define SIGURG 16 /* urgent condition on IO channel */
#define SIGSTOP 17 /* sendable stop signal not from tty */
#define SIGTSTP 18 /* stop signal from tty */
#define SIGCONT 19 /* continue a stopped process */
#define SIGCHLD 20 /* to parent on child stop or exit */
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
#define SIGTTOU 22 /* like TTIN for output if (tp->t_local&LTOSTOP) */
#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#define SIGIO 23 /* input/output possible signal */
#endif
#define SIGXCPU 24 /* exceeded CPU time limit */
#define SIGXFSZ 25 /* exceeded file size limit */
#define SIGVTALRM 26 /* virtual time alarm */
#define SIGPROF 27 /* profiling time alarm */
#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#define SIGWINCH 28 /* window size changes */
#define SIGINFO 29 /* information request */
#endif
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */

iOS侧滑返回功能

发表于 2017-07-03 | 分类于 ios

前言

UINavigationController从iOS7开始,加入了右滑返回的功能。具体的操作,就是从左侧屏幕边缘,向右滑动当前页面,返回上一个页面的效果。

侧滑返回这是一个手势操作,因为iOS SDK中,在UINavigationController增加了这个手势的属性interactivePopGestureRecognizer,如下:

1
@property(nullable, nonatomic, readonly) UIGestureRecognizer *interactivePopGestureRecognizer NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED;

侧滑返回某种意义上,可以算作UI层的默认操作,类似左上角返回按钮。App中可能需要控制这个行为,在用户决定离开当前页面,返回上一层时,弹框询问,或者提交、更新一些数据。

同时,又存在差异:点击返回按钮,这个页面pop到上一层页面的过程是不可逆的;而侧滑返回时,用户中途中断(取消)这个手势,页面并不会返回上一层,而是会恢复到当前页面。

对开发人员来说,如果代码上没有考虑到这点不同,便可能在代码中埋下一些Bug。

阅读全文 »

悬浮窗口调试工具私有类UIDebuggingInformationOverlay

发表于 2017-06-06 | 分类于 ios

起因

最近看到一篇文章(原文),大意是做这位哥们在看Apple的私有API的时候,无意发现UIDebuggingInformationOverlay这么一个类,然后Google也搜不到太多的信息,就自己研究了一下,发现这个类可能是Apple内部用来帮助开发人员和设计人员用来Debug他们的app的。

这个类是一个UIWindow的一个私有子类,可以在App里面显示一个浮动的窗口,里面有当前View的层级结构和一些尺寸信息,很方便的查看相关信息。如图:

image

如何使用

启动App时,加入初始化的相关代码,如下 (原文中是Swift语言版本):

1
2
3
4
5
6
7
8
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
id overlayClass = NSClassFromString(@"UIDebuggingInformationOverlay");
[overlayClass performSelector:NSSelectorFromString(@"prepareDebuggingOverlay")];
return YES;
}

运行App,用两个手指点击顶部的状态栏就可以调出该窗口。

总结

对查找一些UI问题时,比如View和ViewController层级结构、Frame尺寸等,是一个非常直观的工具。如果工程比较大,针对一些页面不知道找什么类的时候,可以通过这个工具反查到View或者ViewController的类名,然后去看代码。

除了能修改透明度以外,其他的参数都没有办法通过这个浮动窗口来调节,如果能加入修改背景色等功能,可能更加实用。

部署Qt应用程序

发表于 2017-05-15 | 分类于 Qt

应用程序开发完成后,需要打包成一个可以执行的包交付测试。常见对应Window、macOS、Linux三个常见桌面操作环境,会采用不同的打包方式。而其中Linux的发行版本众多,制作DEB或者RPM等不同的包也有区别。

阅读全文 »

Dyld Error Message:Library not loaded:xxx

发表于 2017-04-24 | 分类于 macos

前言

最近的一个项目中,网络部分有依赖openssl库,于是用brew安装了openssl。其安装的地址 /usr/local/Cellar/openssl/1.0.2k/ , 同时会在 /usr/local/opt/openssl/生成一个软链接。

在生成的app中,已拷贝依赖的动态库:

  • MyApp.app/Contents/Frameworks/libssl.1.0.0.dylib
  • MyApp.app/Contents/Frameworks/libcrypto.1.0.0.dylib

但当其他电脑(非开发电脑)运行app时,会直接闪退,并看到崩溃的日志,主要如下:

1
2
3
4
Dyld Error Message:
Library not loaded: /usr/local/Cellar/openssl/1.0.2k/lib/libcrypto.1.0.0.dylib
Referenced from: /Volumes/MyApp/MyApp.app/Contents/Frameworks/libssl.1.0.0.dylib
Reason: image not found

阅读全文 »

WebRTC学习笔记(1)- Win/Linux/macOS环境编译

发表于 2017-03-30 | 分类于 webrtc

准备工作

WebRTC属于Chromium项目的子项目,本身可以独立编译,支持的平台包括Windows/Linux/macOS/Android/iOS等。项目本身是C++, 编译脚本也会用到Python。而项目代码托管于Google的服务器上,也就造成国内想要获取源代码,需通过科学上网的方式。所以,一些前置条件必不可少。

环境准备

  1. Win7 64位及以上,笔者用的Win10 64位;DX SDK; Windows SDK;
  2. macOS;
  3. Ubuntu,一定要是Ubuntu,笔者最先用的Mint也被迫换成Ubuntu;
    阅读全文 »

macOS下面查看执行文件依赖信息

发表于 2017-03-06 | 分类于 macos

查看动态链接库信息

通过otool查看:

1
2
3
4
5
6
7
8
$ otool -L CppRest
CppRest:
/usr/local/opt/cpprestsdk/lib/libcpprest.2.9.dylib (compatibility version 2.9.0, current version 0.0.0)
/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/opt/boost/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)

阅读全文 »
12…5
Xinus

Xinus

33 日志
9 分类
39 标签
Links
  • Swift.org
© 2012 - 2017 Xinus