0

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.

thecoolwinter
  • 861
  • 7
  • 22

1 Answers1

1

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.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • So my only option is to combine the two targets if I want a universal app? – thecoolwinter Nov 23 '20 at 17:40
  • I don't understand the phrase "my only option", as if you were being backed into some undesirable conclusion. A universal app _is_ a single app target for an app that runs on both iPad and iPhone. Either one wants that or not. – matt Nov 23 '20 at 18:31
  • I mean I'd like to have a universal app, that was my original plan. What I mean by that is is combining the targets the only way to submit that universal app. – thecoolwinter Nov 23 '20 at 21:46
  • Well, a universal app means you are going to submit only _one_ binary. One app target makes one binary. You cannot submit two different binaries except as two different apps, as you already said. Apple is not going to accept two different binaries along with instructions, "please use this one for iPhone users and this one for iPad users". If we want to play the game we have to play it by Apple's rules. – matt Nov 23 '20 at 22:01
  • In a way, the whole issue rests in your use of the phrase "archive these two targets together". You don't "archive" a "target". An archive doesn't contain any targets. A target is just a set of instructions for building the archive (from your code, etc.). You cannot follow two _different_ sets of instructions for building simultaneously. – matt Nov 23 '20 at 22:06
  • Ahh I see what you mean. Thank you for the explanation, and sorry for the confusion! – thecoolwinter Nov 23 '20 at 22:42