Hello there!
I need to add support of GKSavedGame.
For that purpose i need to add iCloud Documents to the entitlements list.
I see that engine can’t do it byself.
I added icloud documents capatibility and data container to my provision.
Firstly i wrote test ios applcation on pure objective-c under xcode.
I tested all features i need:
- Save data to cloud
- Load saved data
- Resolve conflicts
All works fine.
Then i started to work with unreal engine.
When i enable cloud kit support - it appears in .entitlements file. But i need iCloud Documents to work with GKSavedGame.
So i modified binary engine version - Engine/Source/Programs/UnrealBuildTool/IOS/UEDeployIOS.cs
I added missing entitlements.
To recompile UnrealBuildTool in a binary version of the engine we just need to regenerate xcode project.
private void WriteEntitlementsFile(string OutputFilename, FileReference ProjectFile)
{
// get the settings from the ini file
// plist replacements
// @todo tvos: Separate TVOS version?
ConfigCacheIni Ini = ConfigCacheIni.CreateConfigCacheIni(UnrealTargetPlatform.IOS, "Engine", DirectoryReference.FromFile(ProjectFile));
bool bSupported = false;
Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bEnableCloudKitSupport", out bSupported);
Directory.CreateDirectory(Path.GetDirectoryName(OutputFilename));
// we need to have something so Xcode will compile, so we just set the get-task-allow, since we know the value,
// which is based on distribution or not (true means debuggable)
StringBuilder Text = new StringBuilder();
Text.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
Text.AppendLine("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
Text.AppendLine("<plist version=\"1.0\">");
Text.AppendLine("<dict>");
Text.AppendLine(string.Format(" <key>get-task-allow</key><{0}/>", /*Config.bForDistribution ? "false" : */"true"));
if (bSupported)
{
Text.AppendLine(" <key>com.apple.developer.icloud-container-identifiers</key>");
Text.AppendLine(" <array>");
Text.AppendLine(" <string>iCloud.$(CFBundleIdentifier)</string>");
Text.AppendLine(" </array>");
Text.AppendLine(" <key>com.apple.developer.icloud-services</key>");
Text.AppendLine(" <array>");
Text.AppendLine(" <string>CloudKit</string>");
** Text.AppendLine(" <string>CloudDocuments</string>");**
Text.AppendLine(" </array>");
** Text.AppendLine(" <key>com.apple.developer.ubiquity-container-identifiers</key>");**
Text.AppendLine(" <array>");
** Text.AppendLine(" <string>iCloud.$(CFBundleIdentifier)</string>");**
Text.AppendLine(" </array>");
}
Text.AppendLine("</dict>");
Text.AppendLine("</plist>");
File.WriteAllText(OutputFilename, Text.ToString());
}
For now i see that my application appeared in iCloud permissions settings.
It try to send data to iCloud but gets error:
GKErrorDomain 27. It means that application have no rights to work with iCloud Drive.
I took a look on build log and found that app.xcent was generated without iCloud Documents entitlement.
I took same file from my test xcode project and used it to sign my game. And now application have rights on runtime (but have another error 17 - wring data format or something like that - i will solve it later).
What should i do to generate app.xcent file correctly on engine side to get all entitlements for iCloud Documents and with appropriate icloud container.
Thanks!