使用clang查看源码

问题1. 执行xcodebuild报错

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

解决1. 终端执行如下命令

// Install Xcode
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

问题2. 执行clang -rewrite-objc main.m报错

➜  CopyPropertyForNSStringDemo clang -rewrite-objc main.m
main.m:9:9: fatal error: 'UIKit/UIKit.h' file not found
#import 
        ^
1 error generated.

解决2. 添加相应SDK

xcrun -sdk iphoneimulator clang -rewrite-objc main.m

你可能感兴趣的:(使用clang查看源码)