自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(39)
  • 收藏
  • 关注

转载 跳过 SourceTree 注册

打开sourcetree关闭sourcetree命令终端输入defaults write com.torusknot.SourceTreeNotMAS completedWelcomeWizardVersion 3打开sourcetree即可跳过登录

2019-07-16 15:45:38 111

转载 关联的苹果实现

关联的苹果实现参考

2019-06-16 22:33:04 151

原创 早之笔记-2019-6-10

autorelease(自动释放)这个概念类似 C 语言的自动变量作用域。自动变量声明(等价于 NSAutoreleasePool 的创建),自动变量超出作用域释放(等价于 NSAutoreleasePool 的销毁,调用 autorelease 的对象实例调用 release 方法)。唯一不同的是:autorelease 可以修改其作用域。autorelease 的具体使用方法生成...

2019-06-10 09:49:19 154

转载 Runloop 之重读 ibireme

重读 ibireme参考RunLoop 的概念一个线程一次只能处理一个任务,处理完线程就销毁了。我们希望线程能随时处理事件,且不退出。function loop() { initialize(); do { var message = get_next_message(); processs_message(message); } while (message != qu...

2019-06-04 14:40:27 269

转载 Runloop 之探索 NSTimer 的实现原理

NSTimer 实现原理参考

2019-06-03 16:00:44 593

原创 Runloop 学习之 CFRunloopTimer

CFRunloopTimerCFRunloopTimer 定义struct __CFRunLoopTimer { CFRuntimeBase _base; uint16_t _bits; //标记fire状态 pthread_mutex_t _lock; CFRunLoopRef _runLoop; //添加该timer的runloop ...

2019-06-02 23:03:12 502

原创 Runloop 学习之 CFRunloopSource

CFRunloopSourceCFRunloopSource 定义struct __CFRunLoopSource { CFRuntimeBase _base; uint32_t _bits; //用于标记Signaled状态,source0只有在被标记为Signaled状态,才会被处理 pthread_mutex_t _lock; CFIndex _order...

2019-06-02 21:17:05 735

原创 Runloop 学习之 CFRunloopObserver

CFRunloopObserverCFRunloopObserver 定义struct __CFRunloopObserver { CFRuntimeBase _base; pthread_mutex_t _lock; CFRunLoopRef _runLoop; CFIndex _rlCount; CFOptionFlags _activities; ...

2019-06-02 15:58:22 288

转载 Runloop 学习之实现

RunLoop实现获取RunLoop从苹果开放的API来看,不允许我们直接创建RunLoop对象,只能通过以下几个函数来获取RunLoop:CFRunLoopRef CFRunLoopGetCurrent(void)CFRunLoopRef CFRunLoopGetMain(void)+(NSRunLoop *)currentRunLoop+(NSRunLoop *)mainRunLo...

2019-05-31 21:49:04 131

转载 Runloop 学习之概念

Runloop 学习之概念原文runloop 介绍RunLoop 还是比较顾名思义的一个东西,说白了就是一种循环,只不过它这种循环比较高级。一般的 while 循环会导致 CPU 进入忙等待状态,而 RunLoop 则是一种“闲”等待一个RunLoop对象,主要包含了一个线程,若干个Mode,若干个commonMode,还有一个当前运行的Mode当我们需要一个常驻线程,可以让...

2019-05-31 20:44:54 177

原创 Runtime 学习之消息转发

Runtime 学习之消息转发接受消息的对象没有实现相应的方法,runtime 会发生消息转发机制。resolveInstanceMethod:(SEL)sel动态为该对象添加方法实现。目的:方法A的实现是运行时判断到底执行方法a,还是方法b,一旦确定之后,方法A的实现就确定了,以后再调用方法A时实际是调用方法a或方法b。那么我们就没有必要实现方法A,每次都再重定位到方法a或方法b,我们可...

2019-05-30 15:44:16 94

原创 Runtime 学习之介绍

Runtime 学习之介绍OC 面向对象特性和动态性的的基石是 runtimeruntime 怎么是面向对象特性的基石?我们知道面向对象有3大特性:封装,继承,多态。OC类是不能直接编译成汇编语言的,需要先编译成C语言,而这里的C语言是用 runtime 来实现的。封装:对数据和操作整合成一个有机整体。// 我们可以看到添加属性和方法用到了 runtime 的 API stat...

2019-05-29 20:53:34 141

原创 AutoreleasePool 学习

AutoreleasePool 学习参考clang -rewrite-objc main.c请到苹果官网下载 objc4-706 版本,里面有 AutoreleasePool 源码。__AtAutoreleasePool __autoreleasepool/* @autoreleasepool */ { __AtAutoreleasePool __autoreleasepool; ...

2019-05-28 21:00:47 198

原创 OC atomic 一定能保证线程安全吗

OC atomic 一定能保证线程安全吗atomic 修饰的属性,编译器会在编译期间在 setter, getter 方法里加入一些互斥锁,保证在多线程开发,读取变量的值正确atomic 只能保证 setter, getter 线程安全,如 self.name = xxx。但对于 [array objectAtIndex:index] 无法保证多线程安全。...

2019-05-23 20:52:18 795

原创 属性 Copy 读后感

Property copy attribute 读后感原文不可变字符串,可变字符串,copy,mutableCopy。两两组合,只有【不可变字符串 copy】是浅拷贝,其他组合都是深拷贝可变字符串属性使用 copy 修饰的原因:因为可变字符串 setter 方法会调用 copy 进行的是深拷贝,修改外层字符串值不会影响属性值。若可变字符串用 strong 修饰,则属性和外层字符串指向的是同...

2019-05-23 20:28:15 107

原创 GCD 异步不一定开线程的理解

GCD 异步不一定开线程的理解在串行队列Q的任务A里异步将任务B追加到队列Q中,此时任务B和任务A在一个线程,不开线程。dispatch_queue_t serQueue = dispatch_queue_create("com.zxq.serialdispatch", DISPATCH_QUEUE_SERIAL);dispatch_async(serQueue, ^{ ...

2019-05-23 18:16:30 430

原创 OC 网络小记1

NSURLRequest 代表一个请求,包括请求头,请求体,统一资源定位符,超时时间NSURLConnection 或 NSURLSession 用来建立客户端和服务端的链接NSURLConnection 通过设置请求头 Range 字段来断点续传下载的NSString *range = [NSString stringWithFormat:@"bytes=%lld-", self...

2019-05-23 16:43:46 147

原创 OC +initialize 详解

OC +initialize 详解原文runtime 第一次使用类时,会调用该类的 +initialize 方法,用来类第一次初始化时做一些事情调用方式使用 objc_msgSend,即 isa, superClass 那一套机制来的。调用顺序先调用父类的 +initialize 方法;若父类没有初始化过,则调用父类 +initialize 方法;若父类初始化过,则不调用父类 ...

2019-05-22 14:08:49 388

原创 OC load 方法调用顺序

OC load 方法调用顺序原文先调用父类 load 方法;再调用子类 load 方法;最后调用分类 load 方法;没有继承关系的两个独立类,调用顺序同 Build Phases - Compile Sources 位置顺序;两个独立的分类,调用顺序同 Build Phases - Compile Sources 位置顺序。...

2019-05-22 13:14:16 553

原创 KVO 容易发生哪些奔溃

KVO 容易发生哪些奔溃重复 removeObserver 导致奔溃;观察者从内存释放前,没有 removeObserver,导致野指针访问奔溃;keyPath 传错导致的奔溃,如 valueForKeyPath:。...

2019-05-21 20:12:01 179

翻译 KVO 实现细节或原理

Key-Value Observing Implementation DetailsAutomatic key-value observing is implemented using a technique called isa-swizzling.自动 KVO 实现使用 isa-swizzling 技术When an observer is registered for an at...

2019-05-21 20:05:31 85

转载 didAddSubview:、willRemoveSubview:、willMoveToSuperview:、didMoveToSuperview、willMoveToWindow:

原文// 当视图添加子视图时调用- (void)didAddSubview:(UIView *)subview;// 当子视图从本视图移除时调用- (void)willRemoveSubview:(UIView *)subview;// 当视图即将加入父视图时 / 当视图即将从父视图移除时调用- (void)willMoveToSuperview:(nullable ...

2019-05-21 18:26:44 678

翻译 KVO 两种方式支持属性改变通知发送

Two techniques Ensuring the Changing Notification Emitted官方文档There are two techniques for ensuring the change notifications are emitted.Automatic Change NotificationNSObject provides a basic im...

2019-05-21 18:00:44 103

翻译 KVO automaticallyNotifiesObserversForKey:

KVO automaticallyNotifiesObserversForKey:Return YES if the key-value observing machinery should automatically invoke -willChangeValueForKey:/-didChangeValueForKey:, -willChange:valuesAtIndexes:forKe...

2019-05-21 14:12:26 683

转载 如何确保属性值支持KVC

Make a property KVC Compliant(如何确保属性值支持KVC)How you make a property KVC compliant depends on whether that property is an attribute, a to-one relationship, or a to-many relationship. For attributes an...

2019-05-20 20:22:06 111

翻译 setNilValueForKey:

setNilValueForKey:Invoked by setValue:forKey: when it’s given a nil value for a scalar value (such as an int or float).当使用 setValue:forKey: 把一个 nil 值赋值给纯量(如 float, int, …)时,setNilValueForKey: 会被调用...

2019-05-20 20:16:39 335

翻译 KVO Dependent Keys (注册依赖 Keys)

Registering Dependent Keys官方文档There are many situations in which the value of one property depends on that of one or more other attributes in another object. If the value of one attribute changes, ...

2019-05-20 13:41:00 127

转载 Instruments 调试

Instruments 调试转载

2019-05-14 11:34:55 161

转载 OC 野指针和空指针

OC 野指针和空指针原文

2019-05-13 19:36:57 521

原创 error_list 2019-5-10

Undefined symbols for architecture x86_64:“OBJC_CLASS$_OtherAccount”, referenced from:objc-class-ref in Person.old: symbol(s) not found for architecture x86_64可能是没有实现 OtherAccount @implementatio...

2019-05-10 18:53:01 61

翻译 KVO 阅读(Introduction)

KVOKey-value observing is a mechanism that allows objects to be notified of changes to specified properties of other objects.KVO 是一种机制:当其它对象的特定属性改变时会通知某个对象。...

2019-05-09 21:38:15 72

翻译 Cocoa Core 完整文档

苹果文档地址

2019-05-09 13:27:18 211

翻译 KVC 阅读

Key-value coding(键值编码)参考Key-value coding is a mechanism for indirectly accessing an object’s attributes and relationships using string identifiers.Key-value 编程是一种机制:允许 developer 通过字符串 ID 的方式间接访问对象...

2019-05-08 16:44:58 100

翻译 线程

线程线程(英语:thread)是操作系统能够进行运算调度的最小单位一个进程中可以并发多个线程,每条线程并行执行不同的任务线程可以为操作系统内核调度的内核线程,由用户进程自行调度的用户线程同一进程中的多条线程将共享该进程中的全部系统资源,如虚拟地址空间,文件描述符和信号处理等等但同一进程中的多个线程有各自的调用栈(call stack),自己的寄存器环境(registe...

2019-05-08 11:18:31 80

原创 fishhook 源码阅读

fishhook 源码阅读基本数据prepend_rebindings(...)rebind_symbols_for_image(...)perform_rebinding_with_section(...)_rebind_symbols_for_imagerebind_symbols(...)print_dyld_image_fname(...)理解一下 _dyld_register_func_...

2018-12-27 17:08:54 352

原创 RN 环境配置理解(一)

第一步:把工程跑起来。React Native 中文网 / 搭建开发环境创建一个 RN 工程创建一个独立的完整的 RN 项目,通过 react-native init。配置 NodeJS 环境方式1 (推荐)brew install node方式2手动安装 https://nodejs.org/en/下载 react-native 命令行工具 react-native-c...

2018-12-14 13:37:29 244

原创 react-native bundle

react-native bundle 初学–entry-file js file 根文件–bundle-output bundle 输出文件–dev [boolean]false:会压缩 bundle 文件。true:不压缩 bundle 文件。–platform [string]ios or android–assets-dest [string]bundle 中引用的图...

2018-12-12 11:41:35 389

原创 git merge时出现的一些问题汇总

git · merge时出现的一些问题汇总mergeBranch 修改了文件 file_A,myBranch 也修改了文件 file_A。我想 merge 后保留我的 file_A,舍弃 mergeBranch 的 file_A 修改内容假设我当前的 branch 为 myBranch,merge 的分支为 mergeBranch。mergeBranch 修改了文件 file_A,myBran...

2018-11-30 13:41:58 2293

原创 git · tag

git · tagtag为某次修改添加 commit创建本地标签查看标签推送本地标签到远端删除本地标签删除远端标签tagTag your commit为某次修改添加 commitgit commit -m 'message'创建本地标签git tag -a v1.0.0 -m 'message'查看标签git tag推送本地标签到远端// 推送某个 tag 到远端git...

2018-10-11 14:08:04 108

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除