查看runtime文件

clang -rewrite-objc main.m  报错:
    
****fatal error: ****'UIKit/UIKit.h' file not found**

解决:

  clang -x objective-c -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk xxxxx.m

简便做法,配置 alias

vim ~/.bash_profile
alias runtimeoc='clang -x objective-c -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'
保存退出
执行source ~/.bash_profile(这句一定要执行,执行才会生效)

zsh配置,同上

open ~/.zshrc
alias runtimeoc='clang -x objective-c -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'
保存退出
执行source ~/.zshrc (这句一定要执行,执行才会生效)

执行完之后,会在目录下生成一个 xxx.cpp文件,打开查看就是runtime运行时代码。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容