外观
(unity)瑞雪sdk配置
693 字约 2 分钟
2025-01-13
安卓配置信息
修改gradleTemplate.properties
添加如下配置
android.useAndroidX=true
android.enableJetifier=true
修改mainTemplate.properties
若采用anndoridlib接入,可忽略此项
在dependencies处添加如下依赖
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0' //
implementation 'com.ruixue:rxsdk_weile:3.6.20'
//可选,微信工具库
implementation 'com.ruixue:rxsdk_weixin:3.6.20'
//可选,阿里一键登录
implementation 'com.ruixue:rxsdk_alimobile:3.6.20'
//可选,微信h5
implementation 'com.ruixue:rxsdk_h5pay:3.6.20'
implementation 'com.ruixue:rxsdk_h5pay:3.6.20'
修改项目的build.gradle
增加瑞雪的maven仓库,必须要添加
,否则瑞雪sdk依赖无法下载
在respositories处添加
google()
mavenCentral()
jcenter { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
//瑞雪库地址
maven {
credentials {
username '600685104fb2132a19e09a29'
password '2IfrbLKz50J1'
}
url 'https://packages.aliyun.com/maven/repository/2168735-release-Zcdy1x/'
}
AndroidManifest 配置
若采用anndoridlib接入,可忽略此项
<!-- 网络权限 -->
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:name="com.mzf.base.MzfApplication"
android:allowbackup="true"
android:usesCleartextTraffic="true">
<activity
android:name="com.mzf.mzfunityplugin.MzfProxyUnityActivity"
android:configChanges="fontScale|orientation|keyboardHidden|locale|navigation|screenSize|uiMode"
tools:replace="android:screenOrientation"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="unityplayer.UnityActivity"
android:value="true" />
</activity>
<activity
android:name="com.mzf.plugin.channel.RxPayActivity"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
iOS配置信息
环境要求
- iOS 12或以上
集成 SDK
-导入梦作坊插件 在导出的ios游戏工程中,导入libchannel_rxs.a,以及ChannelSdkProtocol.h,MzfSdkApiUnityBridge.h,MzfUnionApi.h,OrderInfo.h,RoleInfo.h几个文件
-安装 cocoapods 瑞雪的sdk强制要求使用cocoapods进行管理,若已安装cocoapods可忽略本条,若未安装,则安装cocoapods
sudo gem install cocoapods
-创建pod文件 进入项目所在路径,在终端窗口中输入以下命令,创建 Podfile 文件
pod init
-编辑Podfile文件,在目标工程的对应target,添加如下内容 若没有梯子,则需要添加国内镜像源(有梯子可忽略本条)
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
-添加 SDK 依赖 在目标工程的对应target,添加如下内容
pod 'RXSDK_Pure'
-下载依赖 在终端窗口中输入以下命令。pod 命令执行完成后,会生成集成了的 SDK 的 .xcworkspace 后缀的工程文件,双击打开即可更新并安装 SDK。
pod install
或
pod update
工程配置
Info.plist 添加获取 IDFA 权限 Privacy - Tracking Usage Description 此标识符将用于向您推送个性化广告。
关闭 Bitcode
由于 SDK 不支持 Bitcode,所以需要在工程中关闭 Bitcode 选项,将 Enable Bitcode 置为 NO 状态即可
添加 Framework -在 TARGETS > Project Name > General > Frameworks, Libraries, and Embedded Content 菜单,点击 +,将 AuthenticationServices 添加。
-在 TARGETS > Build Phases > Link Binary With Libraries 中将 Status 设置为 Optional。
-Podfile 内容参考
# Uncomment the next line to define a global platform for your project
platform :ios, '12.0'
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
target 'channel_rxs' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for channel_rxs
pod 'RXSDK_Pure'
pod 'RXUIKit'
end