简体   繁体   中英

Multiple Release Environment with Xcode 9 - Swift

I have finished writing a project and released to AppStore. Now i want to duplicate the project and change Bundle ID, Signing certificates, Splash Screen, the project specific links and images used in Storyboard.

Since the Model classes and business model wont change at all. And instead of copy-paste the project, change on classes and when bug comes up fixing it on both projects, changes will be only on interface and signing stuff on the same project.

Is that possible?

Is there anyway that this can be done?

You should create copy of your target, which will allow you to create a separate app with same project business (code) logic and different Bundle ID, Signing certificates, Splash Screen, the project specific links.

Here are steps to create duplicate target:

  1. Select Your Project Target (Project >> General >> Select Target)
  2. Right Click on Project Target
  3. Select Duplicate (Menu popover will provide your option to create a duplicate target)

在此处输入图片说明

  1. Here is duplicate copy of your target, that you can distribute as a New app with same business logic.

在此处输入图片说明

Your future updates/changes in code will effect on both target, if your source code file has assigned both targets.

Note: Just make sure, when ever you create a new file (after creating duplicate/multiple target), assign.select both targets to make it effective for both apps.

在此处输入图片说明

Look at here, my new file TestFile.swift has (links to) multiple targets.

在此处输入图片说明

Now to identify your project target programmatically and differentiate your links:

var API_LINK = ""

if let targetName = NSBundle.mainBundle().infoDictionary?["CFBundleName"] as? String {

    if (targetName == "Test") {

        API_LINK = "http://webservice.Test"

    } else if (targetName == "Test copy") {

        API_LINK = "http://webservice.TestCopy"

    } else {

        print("Something wrong - targetName not found")

    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM