Objective-C Runtime Reference
This document describes the OS X Objective-C 2.0 runtime library support functions and data structures. The functions are implemented in the shared library found at /usr/lib/libobjc.A.dylib. This shared library provides support for the dynamic properties of the Objective-C language, and as such is linked to by all Objective-C applications.
This reference is useful primarily for developing bridge layers between Objective-C and other languages, or for low-level debugging. You typically do not need to use the Objective-C runtime library directly when programming in Objective-C.
The OS X implementation of the Objective-C runtime library is unique to the Mac. For other platforms, the GNU Compiler Collection provides a different implementation with a similar API. This document covers only the OS X implementation.
The low-level Objective-C runtime API is significantly updated in OS X version 10.5. Many functions and all existing data structures are replaced with new functions. The old functions and structures are deprecated in 32-bit and absent in 64-bit mode. The API constrains several values to 32-bit ints even in 64-bit mode—class count, protocol count, methods per class, ivars per class, arguments per method, sizeof(all arguments) per method, and class version number. In addition, the new Objective-C ABI (not described here) further constrains sizeof(anInstance) to 32 bits, and three other values to 24 bits—methods per class, ivars per class, and sizeof(a single ivar). Finally, the obsolete NXHashTable and NXMapTable are limited to 4 billion items.
STRING ENCODING
All char * in the runtime API should be considered to have UTF-8 encoding.
“Deprecated” below means “deprecated in OS X version 10.5 for 32-bit code, and disallowed for 64-bit code.”
Who Should Read This Document
The document is intended for readers who might be interested in learning about the Objective-C runtime.
Because this isn’t a document about C, it assumes some prior acquaintance with that language. However, it doesn’t have to be an extensive acquaintance.
Functions
Working with Classes
class_setSuperclass(OS X v10.5)
Adding Classes
Instantiating Classes
Working with Instances
Obtaining Class Definitions
Working with Instance Variables
Associative References
Sending Messages
When it encounters a method invocation, the compiler might generate a call to any of several functions to perform the actual message dispatch, depending on the receiver, the return value, and the arguments. You can use these functions to dynamically invoke methods from your own plain C code, or to use argument forms not permitted by NSObject’s perform... methods. These functions are declared in/usr/include/objc/objc-runtime.h.
objc_msgSendsends a message with a simple return value to an instance of a class.objc_msgSend_stretsends a message with a data-structure return value to an instance of a class.objc_msgSendSupersends a message with a simple return value to the superclass of an instance of a class.objc_msgSendSuper_stretsends a message with a data-structure return value to the superclass of an instance of a class.
Working with Methods
Working with Libraries
Working with Selectors
Working with Protocols
Working with Properties
Using Objective-C Language Features
Data Types
Class-Definition Data Structures
Instance Data Types
These are the data types that represent objects, classes, and superclasses.
idpointer to an instance of a class.objc_objectrepresents an instance of a class.objc_superspecifies the superclass of an instance.
Boolean Value
Associative References
Constants
Objective-C Runtime Reference的更多相关文章
- Objective C Runtime 开发介绍
简介 Objective c 语言尽可能的把决定从编译推迟到链接到运行时.只要可能,它就会动态的处理事情.这就意味着它不仅仅需要一个编译器,也需要一个运行时系统来执行变异好的代码.运行时系统就好像是O ...
- Objective C运行时(runtime)
#import <objc/runtime.h> void setBeingRemoved(id __self, SEL _cmd) { NSLog(@"------------ ...
- Objective C运行时(runtime)技术的几个要点总结
前言: Objective C的runtime技术功能非常强大,能够在运行时获取并修改类的各种信息,包括获取方法列表.属性列表.变量列表,修改方法.属性,增加方法,属性等等,本文对相 ...
- 刨根问底Objective-C Runtime(4)- 成员变量与属性
http://chun.tips/blog/2014/11/08/bao-gen-wen-di-objective[nil]c-runtime(4)[nil]-cheng-yuan-bian-lian ...
- iOS开发——高级特性&Runtime运行时特性详解
Runtime运行时特性详解 本文详细整理了 Cocoa 的 Runtime 系统的知识,它使得 Objective-C 如虎添翼,具备了灵活的动态特性,使这门古老的语言焕发生机.主要内容如下: 引言 ...
- Objective-C Runtime(转)
博主地址: http://yulingtianxia.com/blog/2014/11/05/objective-c-runtime/ 曾经觉得Objc特别方便上手,面对着 Cocoa 中大量 API ...
- iOS 开发-- Runtime 1小时入门教程
1小时让你知道什么是Objective-C Runtime,并对它有一定的基本了解,可以在开发过程中运用自如. 三.Objective-C Runtime到底是什么东西? 简而言之,Objective ...
- Objective-C:runtime
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css); @import url(/ ...
- 全方位分析Objcetive-C Runtime
本文详细整理了 Cocoa 的 Runtime 系统的知识,它使得 Objective-C 如虎添翼,具备了灵活的动态特性,使这门古老的语言焕发生机.主要内容如下: 引言 简介 与Runtime交互 ...
随机推荐
- Ubuntu 无法登录 coursera 看视频
修改 host 文件 sudo vim /etc/hosts 将下面的内容添加至末尾 52.84.246.72 d3c33hcgiwev3.cloudfront.net
- 二维码扫描极速版2.0.apk
二维码扫描极速版2.0.apk 百度网盘下载地址: http://pan.baidu.com/s/1o686bGI 二维码扫描极速版 描述 二维码扫描极速版,快速识别二维码中的信息. 简单易用. 提高 ...
- char的定义在iOS和Android下是不同的
char is different in iOS and Android!跨平台开发时很容易忽略的非常坑爹的一个区别. 我的需求是实现一个算法,这个算法在iOS和Android下需要保持一致的结果,很 ...
- Android开发--Intent
一:Intent基础知识 Intent:信使,实现四大组件间的通信. 1:实现页面间的跳转,有两种方式: (1):startActivity()方式: (2) 2:使用Intent传递数据的四种方式: ...
- 【223】◀▶ IDL HDF 文件操作说明
参考:I/O - HDF Routines —— HDF 操作函数 01 HDF_SD_START 打开一个 SDS 模式的 HDF 文件. 02 HDF_SD_END 关闭一个 SDS 模式 ...
- Qt Creator Theme FlatDark 配色
1.预处理指令,宏定义 颜色 #FF6AAD 2.普通代码 颜色 #D6CF9A 3.头文件 #D69545 4.系统限定符(namespace, class, public, typedef等) ...
- PHP实用小程序(四)
<HTML> <HEAD> <TITLE>访问文件时间属性</TITLE> </HEAD> <BODY> <? $Last ...
- 删除多余的OracleOraDb11g_home1TNSListenerLISTENER1
oracle 监听服务有 OracleOraDb11g_home1TNSListenerLISTENER 和OracleOraDb11g_home1TNSListenerLISTENER1 两个. 用 ...
- AIRSDK 3.7 加载远程的含有代码的swf文件
之前就说这个版本会解决可以加载远程的含有代码的swf文件的需求.但是,一直比较好奇这个是否行得通,还以为 Adobe 副总裁去了苹果,内部给了特殊待遇. 因为苹果一直就是不允许远程加载代码的,像js文 ...
- jquery操作select(option)的取值,设置和选中
比如 <select class="selector"> <option value ="volvo">Volvo</option ...