开发者

Is it possible to modify main bundle of iOS app?

开发者 https://www.devze.com 2023-03-12 01:05 出处:网络
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 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 defini开发者_运维知识库ng 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.


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.plists and the free version has a #define in the build settings. In my code I have lots of #ifdefs 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消