Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iCloud: Key-value storage is inadequate #1082

Closed
ChrisNZL opened this issue Sep 29, 2022 · 4 comments
Closed

iCloud: Key-value storage is inadequate #1082

ChrisNZL opened this issue Sep 29, 2022 · 4 comments
Labels
📱 mobile Related to Android or iOS (touchscreen). ⚠ priority++ Top priority like all the other issues + 2.
Milestone

Comments

@ChrisNZL
Copy link
Owner

Auto reports from 0.3.6 on iOS. Feedback ID: 20220930-YS6FV

ERROR »  Unable to save to cloud. Key-value store has exeeded its space quota on the iCloud server.
  • It seems the iCloud key-value storage Tallowmere 2 v0.3.6 currently uses (in conjunction with CloudOnce) is limited to 1 MB per user account.
  • This might be okay initially, but a single saved game (after reaching many rooms), or having multiple saved games, will eventually exceed this 1 MB limit.

Tasks:

  • Investigate switching iCloud storage to one of the following:
    • iCloud Documents
    • CloudKit
    • iCloud Containers
      image
@ChrisNZL ChrisNZL added 📱 mobile Related to Android or iOS (touchscreen). ⚠ priority++ Top priority like all the other issues + 2. labels Sep 29, 2022
@ChrisNZL ChrisNZL added this to the 0.3.6b milestone Sep 29, 2022
@ChrisNZL ChrisNZL pinned this issue Sep 29, 2022
@ChrisNZL
Copy link
Owner Author

ChrisNZL commented Oct 2, 2022

Improvements made in 0.3.6b on iOS to address this:

  • Account file strips pending leaderboard score entries of unnecessary data before uploading to tallowmere2.com – this isn't fully utilised yet for iOS (for leaderboard entries), so for now, just doing this temporary measure to reduce chance of the user's account exceeding 1 MB.

Next step:

  • Try to use iCloud Containers or something as mentioned above.

@ChrisNZL
Copy link
Owner Author

ChrisNZL commented Oct 14, 2022

Existing Unity plugins

Cross-Platform Native Plugins (Voxel Busters)

prime31 iCloud Plugin

HovelHouse iCloud and CloudKit Plugin

IOS Native Pro (Stan's Assets)

  • 🔶 Supports CloudKit.
  • 🔶 Lack of support from the developer, according to reviews.
  • 🔶 I've dabbled with this plugin a long time ago, back on Tallowmere 1. API has lots of spelling mistakes; usages of SingIn, for example. I seem to recall a large update / refactor that broke pretty much everything as well at one point, which is when I switched to CloudOnce.

Summary

I don't fancy writing my own Objective-C / Swift plugin for using iCloud Containers (CloudKit) if I can help it.

iCloud Key-value storage seems to work okay "most" of the time, though the 1 MB account limit isn't the best.

Other plugins sound too problematic to pursue ditching CloudOnce.

Next steps

The 1 MB limit is potentially a blocker in the long-run. For now, need to try and work around it:

  • Refactor the Account.t2 file:
    • Move pending leaderboard submissions to a new file: PendingLeaderboardEntries.t2
    • Do not have PendingLeaderboardEntries.t2 be cloud-syncable on iOS.
    • Restore / retain full debug info for pending leaderboard submissions for iOS, rather than stripping them.
    • For iOS, investigate compressing the various .t2 files before converting to Base64.

@ChrisNZL
Copy link
Owner Author

ChrisNZL commented Oct 15, 2022

Or...

Just discovered there is a CloudKit Web Services API, which means I don't have to use a plugin, nor learn Objective-C / Swift – can just use HTTP requests instead.

... or not. Authenticating using the Web Services API requires signing into Apple using a web view or web browser, which is inappropriate for an iOS game.


Not going to pursue writing my own Swift nor Objective-C plugin. Outside my expertise; not worth my time right now.

Found an official Apple repository for Unity plugins, but there is no plugin for iCloud right now. Submitted a request to Apple via Feedback Assistant.

@ChrisNZL ChrisNZL removed this from the 0.3.7 milestone Oct 18, 2022
@ChrisNZL ChrisNZL unpinned this issue Oct 27, 2022
@ChrisNZL ChrisNZL pinned this issue Feb 3, 2023
@ChrisNZL ChrisNZL added this to the 0.3.7o milestone Feb 11, 2023
@ChrisNZL
Copy link
Owner Author

ChrisNZL commented Feb 11, 2023

For 0.3.7o on iOS (long as Apple approves this):

  • New games, and saving games, now uses local storage instead of the iCloud key-value system.

  • Where possible, the game will download saved games from the key-value system, and then delete them from the key-value system (to ensure the 1 MB limit does not get reached).

@ChrisNZL ChrisNZL unpinned this issue Mar 16, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📱 mobile Related to Android or iOS (touchscreen). ⚠ priority++ Top priority like all the other issues + 2.
Projects
None yet
Development

No branches or pull requests

1 participant