ios - 在 Swift 中保护我基于 JSON 的关卡配置数据

标签 ios swift sprite-kit

我正在使用 SpriteKit 在 Swift 中制作一款游戏,我预计(目前)大约有 100 个关卡。它们被分成多个区域(每个区域 20 个级别)。大多数区域都是免费的,但我想制作一两个非常特殊的区域,需要一些努力才能玩。如果值得的话,我什至会要求购买。

因此,为了让事情变得简单,我只是在需要时将所有关卡制作为 JSON 配置文件,我的读者将从中提取设置并合成关卡类。因此我有 100 个关卡文件。

我在考虑这个问题,并意识到没有什么可以阻止攻击者使用像 ifunbox 这样的工具来浏览 JSON 文件、找到高级文件、获取内容、覆盖非高级文件,然后然后免费播放优质内容。

我应该保留 JSON 文件并对其进行加密吗?我在想另一种选择是保留每个级别的级别哈希值并进行比较,但这需要在我的代码文件中包含 100 个哈希值。

有人能给我一个建议,更好地保护我的关卡配置数据,让优质内容保持优质吗?

谢谢!

最佳答案

也许你应该用苹果On Demand Resources这样一开始文件实际上并不在应用程序中,并且只有在购买完成后才会下载高级 map

Benefits of On-Demand Resources

Some of the main ways apps can benefit from on-demand resources include:

Smaller app size. The size of the app bundle downloaded by the user is smaller resulting in faster downloads and more storage room on the device.

Lazy loading of app resources. The app has resources that are used only in certain states. The resources are requested when the app is likely to enter the appropriate state. For example, in a game with many levels, the user needs only the resources associated with the current and next levels.

Remote storage of rarely used resources. The app has resources that are used infrequently. The resources are requested as they are needed. For example, an app tutorial is usually shown once after the app is opened for the first time, and may never be used again. The app requests the tutorial on first launch, and then requests the tutorial only when needed or when new features are added.

Remote storage of in-app purchase resources. The app offers in-app purchases that includes additional resources. The resources for purchased modules are requested by the app after it is launched. For example, a user purchases the SuperGeeky emoticon pack in a keyboard app. The app requests the pack after it finishes launching.

关于ios - 在 Swift 中保护我基于 JSON 的关卡配置数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35858172/

相关文章:

ios - 检测触摸并按住屏幕 iPhone (Xcode)

ios - 暂时停用两个节点之间的物理碰撞(Swift 2,IOS)

ios - 将所有 SKSpriteNode 子节点合并为一个 SKSpriteNode

Swift - 动态生成 NSPredicate?

ios - NSMutableArray (plist) 在特定词典上显示 UIImage

ios - Advanced NSOperation - 在运行时添加依赖

ios - 应用渐变后获得透明的 UIButton

ios - 添加 UIPickerView 作为 subview ,很奇怪

ios - 如何在 swift 中对 UIView 的 AspectFit 背景图像进行 AspectFit?

ios - 我如何解决 NSCocoaErrorDomain :257 when pulling a file from the Files app?