1.首先在Podfile文件必须的加上: use_frameworks! (这个 ! 是有的)
如图1:

2.pod install
3.因为是oc的项目所以在pod swift库的时候,需要做oc-swift的混编
-
创建一个swift的类,并记得点击Create Bridging Header,建立混编桥梁,如图2:
2.jpg
- 这时候系统会自动生成一个Test-Bridging-Header.h
4.这时候编译,会报错: The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.
如图3:

5.解决办法是:
(1)点击项目target - Build Setting - 搜索Swift Language Version ,选择适合的Swift的版本(这里选的最新的Swift 4.1),如图4:

(2)然后,点击Pods,选择你刚添加的那个swift三方库的target,同样的步骤选择swift的版本,如图5:

6.这时候运行项目就可以了
7.另外如果你的项目按照以上几步添加好了之后,还是报错:
linker command failed with exit code 1 (use -v to see invocation)
解决办法可以考虑:在target - Build Setting - other linker flags ,把里面的所有的都删除,只留下$(inherited)
网友评论