main中的运行时(runtime)
2016-05-17 17:02
465 查看
原来 main 函数中就有 runtime 的典型示例
UIApplication 不知道自己的 delegate 具体是什么,可能是 AppDelegate 类,也可能是 XXXAppDelegate 类,所以在编译完成后,UIApplication 不能确定代理指向什么,这只能求助于 runtime,在运行时通过 class name 动态创建代理对象。
PS:感谢学弟的问题。有些远在天边的道理,其实近在眼前
int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }
UIApplication 不知道自己的 delegate 具体是什么,可能是 AppDelegate 类,也可能是 XXXAppDelegate 类,所以在编译完成后,UIApplication 不能确定代理指向什么,这只能求助于 runtime,在运行时通过 class name 动态创建代理对象。
PS:感谢学弟的问题。有些远在天边的道理,其实近在眼前
相关文章推荐
- Understand images & containers
- Codeforces Round #353 (Div. 2) B. Restoring Painting(方块内放数,问有多少种不同的放法)
- svn cleanup failed–previous operation has not finished
- codeforces 675B B. Restoring Painting(暴力枚举)
- hmailserver和rounduce安装
- TNS-00510 IBM/AIX RISC System/6000 Error: 11: Resource temporarily unavailable
- Scaling your cloud——详解 Nova 中的 Region, Cell, Availability Zone, Host Aggregates Zone
- HDU 4251 The Famous ICPC Team Again 划分树
- Gerrit 执行 git pull 的时候,提示 fatal: Out of memory, malloc failed (tried to allocate *** bytes)错误的解决方法
- 运营JobDetail和Trigger定时调用存储过程
- main函数的返回值是int类型,不能是void
- HDU 1021 Fibonacci Again
- http://blog.csdn.net/xiahouzuoxin/article/details/10163109
- Xcode中经常出现的编译错误 linker command failed with exit code...
- Codeforces Round #353 (Div. 2) B. Restoring Painting
- AIDL
- 初识Container View Controller
- 斗地主智能(AI)出牌算法
- 五子棋AI设计
- 【原创】人工智能(Artificial Intelligence)各种技术与算法