一,生成工程
![](https://img.haomeiwen.com/i12591809/93648cbc141a6297.png)
二,配置cocoapad
1,cd 进入到ios工程目录
pod init
执行初始化,会多出Podfile 文件
![](https://img.haomeiwen.com/i12591809/4830456e478efd09.png)
2,配置sdk到Podfile 内
#source 'https://git.xiaojukeji.com/ios/cocoapods-specs.git'
#source 'https://ruby.taobao.org/'
#source 'https://git.oschina.net/akuandev/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'
target 'puzzlescape2_2_0-desktop' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for puzzlescape2_2_0-desktop
end
target 'puzzlescape2_2_0-mobile' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for puzzlescape2_2_0-mobile
# Pods for gameBox_new-mobile
pod 'FairBidSDK', '~> 2.3.0'
# pod 'Google-Mobile-Ads-SDK', '7.50.0'
# pod 'AppLovinSDK'
# pod 'FBAudienceNetwork', '5.5.1'
# pod 'VungleSDK-iOS', '6.4.3'
pod 'Firebase/Core', '~> 6.12.0'
# pod 'Firebase/Core'
# pod 'Firebase/Analytics'
end
source 'https://github.com/CocoaPods/Specs.git' 为配置的pad的源,如果加载比较慢需要翻墙,并添加github本地翻墙的代理。
3,安装install命令
pod install
或者
pod install --verbose --no-repo-update
安装后
![](https://img.haomeiwen.com/i12591809/41838d07c838abc5.png)
会多出以上三个文件
4,运行pod生成的.xcworkspace 工程文件
5,运行报错--“The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.”
解决办法
选中Project->选择Info tab->看看Configurations是不是被设置为 None了,如果是None的话请改为Pods,如图:
![](https://img.haomeiwen.com/i12591809/edb054a6b49ee27d.png)
要选择pods 方式。
三,添加广告sdk等
1,添加ObjC 选项,target >> Build Settings >> Other Linker Flags. Once there, click add new (+), and enter -ObjC.
![](https://img.haomeiwen.com/i12591809/f7657195157bf1b1.png)
2,Link Libraries
libsqlite3.tbd
libxml2.tbd
![](https://img.haomeiwen.com/i12591809/8ebf2298c9716820.png)
2,添加google 统计配置
![](https://img.haomeiwen.com/i12591809/cb4758d92f8e7af9.png)
3,icon配置
![](https://img.haomeiwen.com/i12591809/3abb72d9ddaed45c.png)
4,名称多语言
https://www.jianshu.com/p/3afd030be497
5, @import 报错问题
出现如下报错信息
![](https://img.haomeiwen.com/i12591809/0263669dc7272db2.png)
修改方法
将target中的build setting 设置为enable modules 为YES
![](https://img.haomeiwen.com/i12591809/1084ce02dc3782d6.png)
即可解决
网友评论