A post on devforums clarifies that tvOS apps will be standalone. You will not be able to build a universal app that works on both iOS and tvOS. However, you will be able to share code — assuming I can ever get my conditional compilation of #if os(tvOS)
working.
Don’t confuse universal apps with the universal purchases mentioned in the write-ups: “Empower customers to enjoy their favorite apps on both iOS and the new Apple TV with a single purchase by enabling universal purchase for your app on the App Store.”
It looks like you’ll be able to create a bundle that sells with components for both systems, even if there are two actual apps that you’re building.
2 Comments
Hello, your articles about TVOS are awesome. I have a question: I want to migrate my iOS apps to TVOS but I don’t know what is the best option: 1. create a new project for TVOS and add .h and .m files 2. Add a new target for TVOS in the iOS projects?
The problem for option 1 is: can I use the same bundleID for the TVOS project? I want people who bought my apps don’t buy the TVOS version.
The problem for option 2 is: if I add a new target what will happend when I try to upload my app to itunesConnect to publish it? I don’t know how can I set the targets to include iOS and TVOS apps in the same upload package.
Thanks in advance
Hi Tyflos,
The simple answer is that you can do this, and I think if you have a lot of shared code between iOS and tvOS, this is the way to go. If you add a new target for tvOS to your original project, you can indeed use the same BundleID for tvOS as you used for iOS. This gives you the ‘universal purchase’ thingy, ‘cos they’re both the same app, just different target OS’s.
I was confused about the upload at first, too, but of course if you have two targets in the project, each will build a different Product. So you end up with two different product .ipa’s to upload. I don’t know how it’s gonna work yet, but I presume there will be a separate button in iTunes Connect to upload your tvOS binary.
As a side note, for conditional compilation you can use the symbols below:
#if TARGET_OS_IOS
//…. iOS Specific Code
#endif
#if TARGET_OS_TV
//…. tvOS Specific Code
#endif