前言
做游戏开发的我,零经验,公司要求接入applovin广告,好久都没找到适合新手的详细参考资料,只能硬啃英文文档了。
官方文档:MAX Mediation Documentation
正文
1、打开文档,直接翻到苹果接入部分。

拷贝到项目中,再在xcode中添加引用。

2、注意这个部分,要你在你的项目中的info.plist添加AppLovinSdkKey字段,值填广告后台账户的SDK Key。


3、SDK初始化

回到文档,以下圈出来的不用关心,直接看广告接入部分。


4、根据文档编写相应广告加载播放逻辑,略。
遇到的问题
1、项目打包出现报错:linker command failed with exit code 1 (use -v to see invocation)
具体如下:
ld: Undefined symbols:
__swift_FORCE_LOAD_$_swiftCompatibility50, referenced from:
__swift_FORCE_LOAD_$_swiftCompatibility50_$_AppLovinSDK in AppLovinSDK[395](AdapterDelegate.o)
__swift_FORCE_LOAD_$_swiftCompatibility51, referenced from:
__swift_FORCE_LOAD_$_swiftCompatibility51_$_AppLovinSDK in AppLovinSDK[395](AdapterDelegate.o)
__swift_FORCE_LOAD_$_swiftCompatibilityConcurrency, referenced from:
__swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_AppLovinSDK in AppLovinSDK[395](AdapterDelegate.o)
__swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements, referenced from:
__swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements_$_AppLovinSDK in AppLovinSDK[395](AdapterDelegate.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
百度告诉我在项目目录下新建一个swift脚本,不用写啥,再打包就可以了,实测有效。
2、加载广告提示网络错误
考虑app包名是否和广告id设置的一致。
本文讲述了作者作为游戏开发新手在尝试接入AppLovin广告时遇到的问题,包括打包时的链接器错误和网络错误,以及解决方法——添加Swift脚本和检查包名与广告ID的一致性。

959

被折叠的 条评论
为什么被折叠?



