1、cd到需要转换的.m文件所在的文件夹(非工程)
2、执行clang -rewrite-objc STTest.m 如果报错'UIKit/UIKit.h' file not found,则需要转成下面的命令
lifangjiandeMacBook-Pro-2:GradientLayer lifangjian$ clang -x objective-c -rewrite-objc -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk STTest.m
eg:把STTest.m转成STTest.cpp
使用__weak
// MRC
xcrun -sdk iphoneos clang -arch arm64 -rewrite-objc main.m
// ARC
xcrun -sdk iphoneos clang -arch arm64 -rewrite-objc -fobjc-arc -fobjc-runtime=ios-8.0.0 main.m