是否可以修改 iOS 应用程序的主包?
我想提供两个版本的 iOS 应用程序:付费版和免费版(带广告)。我的目标是保持代码库相同,只更改一个标志来指示我想要构建哪个版本。
我已经为我的应用程序准备了两个构建目标来支持这种分离,如所述此处。这些目标的捆绑 ID 有所不同。
现在,我想根据给定的捆绑包 ID 更改标志。我尝试读取主包标识符,效果很好。我的问题就从这里开始。
下载免费应用程序后是否可以更改主捆绑包 ID,以未经授权访问付费版本?我找到了这里,此处和此处 事实并非如此。
但是...越狱手机怎么办?我读过一些评论,确实如此。
如果是这样,我如何保护我的应用程序?
我也在考虑定义像 #define FREE_APP
这样的预处理器指令。然后我会检查:
#ifdef FREE_APP
//show ads
#endif
但是这个解决方案不能仅通过选择构建来完全自动化 - 我仍然需要手动更改这个值 - 所以它不是最好的。将不胜感激的建议。
I want to provide two versions of my iOS app: paid and free with ads. My goal is to keep the code base the same and change only a flag to indicate which version I want to build.
I've prepared two build targets for my app to support this separation, as described here. These targets differs in Bundle ID.
Now, I'd like to change the flag based on given Bundle ID. I've tried to read main bundle identifier and it worked perfectly. And here my question starts.
Is it possible to change the main bundle ID after downloading the free app to get an unauthorized access to paid version? I found here, here and here that it isn't.
But... what about jailbroken phones? I've read in some comments, it is.
If so, how can I protect my app?
I was also thinking about defining preprocessor directive like #define FREE_APP
. Then I'd check:
#ifdef FREE_APP
//show ads
#endif
But this solution can't be totally automatized just by selecting build - I'd still need to change this value manually - so it isn't the best. Will be grateful for suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
直接回答你的问题,几乎可以肯定是的。但我认为这并不重要。
想要盗版您的应用程序的人可能只会等到有人购买并破解您的付费应用程序;我怀疑他们会经历破解你的免费版本的麻烦。
就我个人而言,我的项目有两个目标。这两个应用程序具有不同的
Info.plist
,免费版本在构建设置中具有#define
。正如您所建议的,在我的代码中,我有很多#ifdef
。自动化是可能的(但有时会变得有点混乱)。当然,您的另一个选择是通过 InAppPurchase 升级到完整版本的单个应用程序。只是要小心专利流氓。
To directly answer your question, almost certainly yes. But I would argue that it doesn't matter.
The people who want to pirate your app would probably just wait until someone bought and cracked your paid app; I doubt they'd go through the hassle of hacking your free version.
Personally, I have two targets in my project. The two apps have different
Info.plist
s and the free version has a#define
in the build settings. In my code I have lots of#ifdef
s as you suggest. It is possible to automate (but it can get a bit messy at times).Of course, your other option would be a single app with an InAppPurchase to upgrade to the full version. Just be careful of patent-trolls.