jansensan
jansensan

Reputation: 627

How to create a 2nd app from a 2nd target in XCode?

So I created a simple project, which I can test as an iPhone app. Now I'd like to make a slight variation of it, with an iAd. I was able to duplicate the target and test to the iPhone, by managing schemes (http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/Building/Building.html).

The issue is that no matter what scheme I test, I overwrite the other app. I'd like to be able to have two apps

living at the same time on my phone.

I want to avoid duplicating source files, because only the storyboard and the view controller are different, they both use the same images and model otherwise.

Any help is welcome!

Upvotes: 1

Views: 58

Answers (2)

jfmajor
jfmajor

Reputation: 83

I'm not currently on my Mac partition so sorry if I'm a bit off. I would add a new configuration for your app. Call it something like "Release Free". Add a gcc preprocessor symbol "FREE" to this configuration. Then everywhere you initialize and instantiate your iads put the code within some "#if" statements.

Something like this.

#if FREE
    // Init iAds
#endif

Upvotes: 0

Gwynant Jones
Gwynant Jones

Reputation: 319

Have you tried changing the bundle identifier in the new target you just created? So your full version would have bundle identifier: "com.yourcompany.AppName" and your lite version will have a bundle identifier of: "com.youcompany.AppNameLite"

Upvotes: 2

Related Questions