随笔分类 -  oc

摘要:- (void)run; - (void)runUntilDate:(NSDate *)limitDate;- (BOOL)runMode:(NSRunLoopMode)mode beforeDate:(NSDate *)limitDate; Puts the receiver into a per 阅读全文
posted @ 2023-01-10 16:12 zzfx 阅读(34) 评论(0) 推荐(0) 编辑
摘要:内存管理是引用、被引用关系的管理 数据结构: 引用计数 isa、weak 表、autoreleasepool 栈、关联对象表 算法: _objc_rootRelease, dealloc --> objc_rootDealloc -->objc_dispose -->objc_destructIns 阅读全文
posted @ 2022-06-29 10:43 zzfx 阅读(36) 评论(0) 推荐(0) 编辑
摘要:运行时的消息转发 https://www.cnblogs.com/feng9exe/p/10945712.html 其实在 objc-msg-x86_64.s 中包含了多个版本的 objc_msgSend 方法,它们是根据返回值的类型和调用者的类型分别处理的: objc_msgSendSuper:向 阅读全文
posted @ 2022-05-29 23:03 zzfx 阅读(44) 评论(0) 推荐(0) 编辑
摘要:class_addMethod will add an override of a superclass's implementation, but will not replace an existing implementation in this class. To change an exi 阅读全文
posted @ 2022-02-17 19:52 zzfx 阅读(54) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/chaoyuan899/article/details/107183847 // Replaced by CF (throws an NSException) + (void)doesNotRecognizeSelector:(SEL)sel { _obj 阅读全文
posted @ 2021-10-28 21:54 zzfx 阅读(55) 评论(0) 推荐(0) 编辑
摘要:iOS内存泄漏检查&原理 前面罗列了iOS中常见的会导致内存泄漏的场景, 这篇文章主要说一下内存泄漏的常见检测方式和原理. 1 内存分类 要想检查内存泄漏, 首先我们要了解一个 app 的内存分类. 苹果的开发者文档里可以看到,一个 app 的内存分三类: Leaked memory: Memory 阅读全文
posted @ 2021-07-08 21:03 zzfx 阅读(1373) 评论(0) 推荐(0) 编辑
摘要:在Objective-C中,由于方法调用都是在运行期确定的,因此没有针对方法的symbol,只有针对类的。 Oc 编译错误、符号与链接、加载 oc 语言只在编译时进行符号声明存在检查,不存在链接阶段的解析 No visible @interface for ‘xxxx’ declares the s 阅读全文
posted @ 2021-06-05 12:47 zzfx 阅读(208) 评论(0) 推荐(0) 编辑
摘要:神经病院Objective-C Runtime出院第三天——如何正确使用Runtime 阅读全文
posted @ 2021-05-31 14:14 zzfx 阅读(50) 评论(0) 推荐(0) 编辑
摘要:NSObject的释放 通过runtime源码,很清晰的可以看,NSObject调用dealloc后产生函数调用链如下:dealloc --> objc_rootDealloc -->objc_dispose -->objc_destructInstance最终调用了一个objc_destructI 阅读全文
posted @ 2021-03-11 13:15 zzfx 阅读(247) 评论(0) 推荐(0) 编辑
摘要:objc_msgSend NSInvalidArgumentException SEL和具体参量都是objc_msgSend的参量,需要做合法性检查 NSInvalidArgumentException: 1、参数的合法性检查,在功能处理阶段;属于防御性编程问题。 1 libobjc.A.dylib 阅读全文
posted @ 2020-10-28 20:31 zzfx 阅读(336) 评论(0) 推荐(0) 编辑
摘要:对象、变量、变量修饰符、赋值 1、站在对象和引用计数的角度看:我不关心谁拥有我,我只关心谁想我发出了维护消息; [_dog release]; 2、任何变量的赋值,都代表了内存规则的进一步维护; 引用计数的语义是什么? 指针,内存变量、对象 strong、retain、release:向对象发送消息 阅读全文
posted @ 2020-10-19 16:16 zzfx 阅读(182) 评论(0) 推荐(0) 编辑
摘要:atomic的作用只是给getter和setter加了个锁,atomic只能保证代码进入getter或者setter函数内部时是安全的,一旦出了getter和setter,线程就不再是安全的了 这时候处理线程安全 就得靠自己加锁了 http://liuduo.me/2018/02/08/object 阅读全文
posted @ 2020-10-11 22:48 zzfx 阅读(160) 评论(0) 推荐(0) 编辑
摘要:Using a declared property for the interface but implementing the property manually by writing the accessor implementations yourself is perfectly fine. 阅读全文
posted @ 2020-08-04 10:56 zzfx 阅读(143) 评论(0) 推荐(0) 编辑
摘要:这篇文章由很多平时的笔记积攒而成,看起来会有些杂乱,会有很多需要改进的地方,希望发现问题的朋友不吝赐教。 类簇 类簇是Foundation框架广泛使用的设计模式。类簇在公共抽象超类下对多个私有的具体子类进行分组。以这种方式对类进行分组简化了面向对象框架的公共可见体系结构,而不会降低其功能丰富度。类簇 阅读全文
posted @ 2020-06-28 13:22 zzfx 阅读(747) 评论(0) 推荐(0) 编辑
摘要:理解“不存在”的概念不仅仅是一个哲学的问题,也是一个实际的问题。我们是 有形 宇宙的居民,而原因在于逻辑宇宙的存在不确定性。作为一个逻辑系统的物理体现,电脑面临一个棘手的问题,就是如何用 存在 表达 不存在 . 在 Objective-C 中,有几个不同种类的 不存在。这样做的原因要追溯到一个频繁提 阅读全文
posted @ 2020-04-21 18:14 zzfx 阅读(214) 评论(0) 推荐(0) 编辑
摘要:They differ in their types. They're all zero, but NULL is a void *, nil is an id, and Nil is a Class pointer. 各种类型的不存在的表示。 理解“不存在”的概念不仅仅是一个哲学的问题,也是一个实 阅读全文
posted @ 2020-04-21 18:10 zzfx 阅读(126) 评论(0) 推荐(0) 编辑
摘要:In the standard environment, objects are allocated on the heap, and their lifetime is manually managed using a reference count. This is done using two 阅读全文
posted @ 2020-04-12 21:16 zzfx 阅读(287) 评论(0) 推荐(0) 编辑
摘要:Programming with Objective-C -- 属性的缺省实现 https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Workingwi 阅读全文
posted @ 2020-04-03 18:08 zzfx 阅读(148) 评论(0) 推荐(0) 编辑
摘要:Because initialize is called in a thread-safe manner and the order of initialize being called on different classes is not guaranteed, it’s important t 阅读全文
posted @ 2020-03-12 11:02 zzfx 阅读(375) 评论(0) 推荐(0) 编辑