升级指引
对于不需要额外操作的 SDK 版本,下载最新版本的 SDK 并用新的 SDK 文件替换旧的 SDK 文件,同时保留旧版本的所有配置。
对于需要额外操作的 SDK 版本,参考每个版本单独的升级指引。
Player Network SDK V1.17 之前的版本升级说明,请联系 Player Network 助手。
按照指引升级完成后,请对照本文中的清单进行检查。
检查配置
建议使用比较工具(例如 "Beyond Compare")比较新旧版本,并逐个更新配置。
INTLConfig.ini
INTLConfig.ini
在工程中的路径为:
- Unity
- Unreal Engine
1.17.00 | 1.16.05 |
---|---|
INTLSDK/Scripts/INTLConfig/Editor/Resources/INTLConfig.ini | Android: /Plugins/Android/assets/INTLConfig.ini iOS: /Plugins/iOS/INTLSDK/INTLCore/INTLSDK.bundle/INTLConfig.ini Windows, PS5: /Plugins/x86_64/INTLConfig.ini Nintendo: /Plugins/Switch/INTLConfig.ini |
1.17.00 | 1.16.05 |
---|---|
INTLSDK/Source/INTLConfig/Configs/Resources/INTLConfig.ini | Android: INTLSDKPlugin/Source/INTLSDKPlugin/INTLSDK/Android/assets/INTLConfig.ini iOS: INTLSDKPlugin/Source/INTLSDKPlugin/INTLSDK/iOS/INTLCore/INTLSDK.bundle/INTLConfig.ini Windows, PS5: INTLSDKPlugin/Source/INTLSDKPlugin/INTLSDK/resources/INTLConfig.ini Nintendo: INTLSDKPlugin/Source/INTLSDKPlugin/INTLSDK/Switch/INTLConfig.ini |
建议比较每个字段,以确保 INTLConfig.ini
文件中的每个配置都是正确的。
Firebase 配置
Firebase 配置文件的路径是:
Android:Assets/Plugins/Android/google-services.json
iOS:Assets/Plugins/iOS/INTLSDK/INTLFirebase/ThirdSDK/GoogleService-Info.plist
确保对应平台的 Firebase 配置文件未被删除,并且所有配置项都正确。
Gradle 配置
Gradle 配置文件的路径是:
- Unity
- Unreal Engine
Unity 2018.x 及之前版本:\Plugins\Android\mainTemplate.gradle
Unity 2018.x 及之后版本:
\Plugins\Android\baseProjectTemplate.gradle
launcherTemplate.gradle
mainTemplate.gradle
/Plugins/INTLSDKPlugin/Source/INTLSDKPlugin/INTLSDK/Android/INTLCore_UPL.xml
确保配置文件中的 ID 和其他值没有被覆盖。
Info.plist
- Unity
- Unreal Engine
INTL{Plugin}Kit.projmods
是 Player Network SDK 的 Info.plist
配置文件。Player Network SDK 会读取 INTLSDK/Editor/XUPorter/Mods
目录中的 INTL{Plugin}Kit.projmods
文件,并在 Xcode 中添加导入的 bundle、框架和其他依赖包。
由于每个 INTL{Plugin}Kit.projmods
文件都对应一个 SDK 插件,因此打包前要检查并更新所有 .projmods
文件中的占位符。
对于 Player Network SDK V1.18 及更高版本,检查 INTLSDK/Source/INTLConfig/Configs/iOS/Plist/
目录中的所有 .plist
文件是否配置正确。
对于早期版本的 Player Network SDK,请检查 Unreal Engine > Settings > Project Settings > Platforms > iOS > Extra PList Data 是否配置正确。
关于每个渠道的正确配置,请参见配置登录鉴权服务的 教程。
Swift 配置
如果插件包使用 Swift SDK,将出现 iOS Swift 和 Objective-C 的混编问题。按照以下步骤操作创建桥接层,使两种编程语言的类名保持一致:
Facebook 和 LINE 插件使用 Swift,在 Xcode 中打包时需特别注意此配置。
- Unity
- Unreal Engine
For Unity 2019.x, skip step 1 to step 4.
Create a new file of the Swift File type.
Specify the file name with an
.swift
extension, and click Create.Click Create Bridging Header.
注意Make sure to click Create Bridging Header. Otherwise, Xcode will not create a bridging header.
Check that two files are created in the Xcode project (one is the
.swift
file created in step 2, and the other is the automatically createdproject_name-Bridging-Header.h
file).说明Do not modify the file content.
In Xcode, go to UnityFramework and enter Library Search Paths in the search box on the upper right corner of the page.
Add the following configurations to Library Search Paths on the search results page.
(Keep the order consistent)
$(SDKROOT)/usr/lib/swift
$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)
$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME}Enter Other Linker Flags in the search box on the upper right corner of the page.
Add
-lswiftCompatibility51
to Other Linker Flags on the search results page.
Create a new file of the Swift File type.
Specify the file name with an
.swift
extension, and click Create.Click Create Bridging Header.
注意Make sure to click Create Bridging Header. Otherwise, Xcode will not create a bridging header.
Check that two files are created in the Xcode project (one is the
.swift
file created in step 2, and the other is the automatically createdproject_name-Bridging-Header.h
file).说明Do not modify the file content.
When using Xcode 12 or a later version, add the following code in
/Plugins/INTLSDK/Source/INTLCore/INTLCore.Build.cs
.PublicSystemLibraryPaths.Add("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos");
PublicSystemLibraryPaths.Add("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos");注意Player Network SDK has already included the necessary code. However, the following error occurs when compiling Unreal Engine with the Swift library from Xcode 12 or later. For versions earlier than Xcode 12, you can skip this step.
Since the iOS Swift module cannot be directly added to Unreal Engine, you must modify the local Unreal Engine source code.
Add the following code in the
private void AppendProjectBuildConfiguration(StringBuilder Content, string ConfigName, string ConfigGuid)
function of/Your_UE_Installation_Path/Engine/Source/Programs/UnrealBuildTool/ProjectFiles/Xcode/XcodeProject.cs
.// Enable Swift
Content.Append("\t\t\t\tCLANG_ENABLE_MODULES = YES;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tSWIFT_VERSION = 5.0;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tLIBRARY_SEARCH_PATHS = \"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\";" + ProjectFileGenerator.NewLine);
if (ConfigName == "Debug")
{
Content.Append("\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";" + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tEMBEDDED_CONTENT_CONTAINS_SWIFT = YES;" + ProjectFileGenerator.NewLine);Add the following code in the
string GetLinkArguments_Global(LinkEnvironment LinkEnvironment)
function of/Your_UE_Installation_Path/Engine/Source/Programs/UnrealBuildTool/Platform/IOS/IOSToolChain.cs
.// enable swift support
Result += " -rpath \"/usr/lib/swift\"";
Result += " -rpath \"@executable_path/Frameworks\"";
// /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/swift/
String swiftLibPath = String.Format(" -L {0}Platforms/{1}.platform/Developer/SDKs/{1}{2}.sdk/usr/lib/swift",
Settings.Value.XcodeDeveloperDir, bIsDevice? Settings.Value.DevicePlatformName : Settings.Value.SimulatorPlatformName, Settings.Value.IOSSDKVersion);
Result += swiftLibPath;
Log.TraceInformation("Add swift lib path : {0}", swiftLibPath);
///Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos
swiftLibPath = String.Format(" -L {0}Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/{1}",
Settings.Value.XcodeDeveloperDir, bIsDevice? Settings.Value.DevicePlatformName.ToLower() : Settings.Value.SimulatorPlatformName.ToLower());
Result += swiftLibPath;
Log.TraceInformation("Add swift lib path : {0}", swiftLibPath);
///Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos
swiftLibPath = String.Format(" -L {0}Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/{1}",
Settings.Value.XcodeDeveloperDir, bIsDevice? Settings.Value.DevicePlatformName.ToLower() : Settings.Value.SimulatorPlatformName.ToLower());
Result += swiftLibPath;// This line of code must be prepended (see the sample image below for the position of the prepended code)
// enable swift support, make sure '/usr/lib/swift' goes before '@executable_path/Frameworks'
Result += " -rpath \"/usr/lib/swift\"";// enable swift support
Result += " -rpath \"@executable_path/Frameworks\"";
// /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/swift/
String swiftLibPath = String.Format(" -L {0}Platforms/{1}.platform/Developer/SDKs/{1}{2}.sdk/usr/lib/swift",
Settings.Value.XcodeDeveloperDir, bIsDevice? Settings.Value.DevicePlatformName : Settings.Value.SimulatorPlatformName, Settings.Value.IOSSDKVersion);
Result += swiftLibPath;
Log.TraceInformation("Add swift lib path : {0}", swiftLibPath);
///Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos
swiftLibPath = String.Format(" -L {0}Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/{1}",
Settings.Value.XcodeDeveloperDir, bIsDevice? Settings.Value.DevicePlatformName.ToLower() : Settings.Value.SimulatorPlatformName.ToLower());
Result += swiftLibPath;
Log.TraceInformation("Add swift lib path : {0}", swiftLibPath);
///Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos
swiftLibPath = String.Format(" -L {0}Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/{1}",
Settings.Value.XcodeDeveloperDir, bIsDevice? Settings.Value.DevicePlatformName.ToLower() : Settings.Value.SimulatorPlatformName.ToLower());
Result += swiftLibPath;
// Xcode 12 adds the swiftCompatibility51 library, so you need to add the following code
if (Settings.Value.IOSSDKVersionFloat >= 14.0f)
{
Result += String.Format(" -lswiftCompatibility51");
}
Open the solutions and recompile
/Users/intl/UE4/UE_4.25/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.sln
.
各渠道配置
关于每个渠道的正确配置,请参见配置登录鉴权服务的 教程。