Combine two Xcode targets into one distributable app

Stack Overflow Asked by thecoolwinter on December 8, 2020

I created two targets in my Xcode project. One for an iOS app, and the other for the iPadOS companion. Now I’d like to distribute them under one name and App Store link, but I can’t submit different builds for iOS and iPadOS through App Store Connect.

I can’t combine the targets into one, because I have some UI libraries that won’t work on iPadOS and/or won’t work on iOS. I’m also planning on making the iPadOS target into a Mac-Catalyst app, so I’d like to keep the targets separate for that as well.

Is there a way to archive these two targets together so App Store Connect sees both apps in the one upload? Or do I need to distribute the iOS and iPadOS apps under different bundle IDs.

One Answer

You certainly could distribute them under different bundle IDs. It's very easy to make two targets share code, as you are probably already doing.

However, it is more usual to have just one app, a so-called "universal" app, that runs on both iPhone and iPad (and so is built using just one app target). It is quite normal for these to have some functionality that differs by device type; resources such as images or nibs can automatically load different versions depending on whether we're running on an iPhone or an iPad, and the traitCollection has a userInterfaceIdiom property that lets your code decide in real time what to do depending on that same distinction.

So just go ahead and load all your "UI libraries" for both device types, and just don't call into one of them if it isn't supported by the current circumstances in which the app finds itself running.

Correct answer by matt on December 8, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP