查看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运行时代码。

你可能感兴趣的:(查看runtime文件)