TARGET_OS_IPHONE is true when compiling for appletvos

Originator:info
Number:rdar://22639221 Date Originated:09-Sep-2015 10:30 PM
Status:Open Resolved:
Product:Developer Tools Product Version:7.1 Beta 1
Classification:Serious Bug Reproducible:Always
 
Summary:
When compiling a target with SDKROOT=appletvos, the macro TARGET_OS_IPHONE is true.

Steps to Reproduce:
Create an Apple TV target (either app or framework I suppose, but I’m reproducing this in a framework).

Expected Results:
TARGET_OS_IPHONE is either not defined, or false.

Actual Results:
TARGET_OS_IPHONE is true

Regression:
This makes this macro not usable to be able to compile things only for iOS. In my case, I need to only compile MapKit related code conditionally, and leave it out for the AppleTV version of the framework.

Comments

This is not a bug. tvOS is an evolutionary subclass of iOS (formerly "iPhone OS"). You need to use TARGET_OS_IOS instead, which is NOT defined to 1 on tvOS.

By jake.petroules at Sept. 10, 2015, 7:17 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!