0

I am finishing up my first application and researched some methods to make use of two targets in the same project. There are few functions that will reduce the free version and will add adbmob banner. The various tutorials that follow, the one who worked to differentiate the targets was this: How to get Target name?

I researched other ways to accomplish this task are old threads and could not make it work.

I tried to add in FREE_VERSION Precompiler macros and many errors occurred. I also tried to add FREE_VERSION in Other C flags within LLVM 5.1 - Custom Compiler flags.

I'm not sure if these methods still work, or if there are better. Does anyone have a more current way to accomplish this or can I use the method I quoted at the beginning of the topic?

Community
  • 1
  • 1
  • You need to be more specific about what you mean by "better." – Robert Harvey Mar 25 '14 at 15:16
  • If you're getting errors when using precompiled macros you're doing something wrong, obviously. It's something that is used very often (I have lots of them in every project, both in .pch and defined in xcconfig files). But _"many errors occurred"_ is not a description we can work with. – DarkDust Mar 25 '14 at 15:21
  • @RobertHarvey My doubt is whether the method I'm using is the "correct" way. If it really will work when sending to apple. – Guilherme M. Machado Mar 25 '14 at 15:21
  • It is "correct" in terms of: it's working. You can create two versions of your app this way that you can submit to Apple. They must have different Bundle Identifiers, of course. We're doing it like this quite often. – DarkDust Mar 25 '14 at 15:23
  • @DarkDust Checking one of several errors that appeared when I added the macro I noticed that I was adding the wrong way. One of the errors that appeared was: "error: macro names must be identifiers". I had added "-FREE_VERSION" while the correct would be "FREE_VERSION = 1".Thanks! – Guilherme M. Machado Mar 25 '14 at 15:42

1 Answers1

1

You can use a Preprocessor macro to mask off code that should run only in one version or the other, and you can use User-Defined Build Settings to differentiate important fields in your app's property list. Just make sure you produce archives for each version while in the correct build scheme when you're submitting.

However, Apple is becoming less friendly to "upselling", so if your free version asks the user to consider downloading the paid version, it will likely be rejected (they will cite guideline 2.9). To avoid that, you can either make a single version which is free and upgrades with an In-App Purchase, or you can be careful to make sure that the free version doesn't push the user toward the paid version.

Justin Johns
  • 406
  • 1
  • 3
  • 11
  • Thank you! I commented on my topic that could use macros. Very interesting this issue you reported me now, I will first send the paid version because I still have to finish some things in the free version, so I'll see if I use the In-App Purchase feature. Thanks for the tip! – Guilherme M. Machado Mar 26 '14 at 14:57