1、weex的sdk文件夹拖到项目目录
2、创建一个Podfile,增加以下内容
pod 'WeexSDK', :path=>'./sdk/'
执行pod install,出现警告了!!!
CocoaPods did not set the base configuration of your project because your project already has a custom config......
运行下项目,报错了!!!
diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
各种找,各种试之后,发现问题:
已有项目用的自定义的xcconfig文件作为配置,和cocoapods冲突
解决办法:
找一个可以运行weex的干净项目,把xcconfig文件的内容复制过去
Pods.debug.xcconfig内容:
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SocketRocket" "${PODS_ROOT}/Headers/Public/WeexSDK"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/SocketRocket" -isystem "${PODS_ROOT}/Headers/Public/WeexSDK"
OTHER_LDFLAGS = $(inherited) -ObjC -l"SocketRocket" -l"WeexSDK" -l"icucore" -framework "AVKit" -framework "CFNetwork" -framework "Security"
PODS_ROOT = ${SRCROOT}/Pods
复制到已有项目的xcconfig文件(红框内为复制的内容)
如果有其他xccongfig文件,就都加上,问题解决!
然而还是运行不了。。。报了新的错误:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_WXAppConfiguration", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_WXSDKEngine", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
原因:
在build setting里的other linker flags 只写了一个-Objc,也不知道哪里用到这个参数了
在后面增加一行:$(inherited)
运行,ok了!