DEVELOPERS BLOG

BlackBerry Dynamics for iOS: Two Targets in One Xcode Project

When you integrate your existing app with the BlackBerry Dynamics SDK, you will need to create a separate version of your app with the BlackBerry Dynamics SDK. Depending on the complexity of your app, there are two routes you can consider for the source code management.

  1. Manage two separate source repositories/branches, one with the BlackBerry Dynamics APIs and another one without.
  2. Create two different targets of an iOS project and build two different IPAs.

I have a simple trick how to achieve the second option above and would like to demonstrate in the following steps. Setting up two targets in a project is useful when creating two IPAs from one project.

After following the steps, you will be able to create two different targets of a project, one with BlackBerry Dynamics SDK integrated and other without BlackBerry Dynamics SDK.

  1. Duplicate the target.

2. Change the Bundle Identifier of the duplicated target.

 

3. For Objective-C

a. Go to Build Settings and search for Preprocessor Macros.

b. Add the value DEVELOPMENT=0 in Debug and Release in the original target and DEVELOPMENT=1 in Debug and Release in the duplicated target.

4. For Swift

a. Go to Build Settings and search Swift Complier.

b. Add the value –DDEVELOPMENT to Other Swift Flags to only one of the targets and not both.

 

5. You can change some additional Build Settings, Info settings.

6. This is how to detect which target is build.

7. You can add new files to a specific target.

That’s it for now… Happy Coding!

 

Need Development Help? The BlackBerry Developer Community Forum has your Answer…

Join the conversation, engage with peers, share product ideas, and get your app development questions answered. This free BlackBerry Developer Program resource allows you to be part of a Developer Community that is at the center of all the information you’ll need to stay connected with the World’s leading Secure Development Platform for Enterprise. Read more about the Developer Community on our blog, and we encourage you to follow the Developer Community forum and join the conversations happening right now.

 

Gurjit Ghangura

About Gurjit Ghangura

Enterprise Solutions Developer, Love BlackBerry, Developer at Heart.