LoginSignup
5
6

More than 5 years have passed since last update.

本当は怖いTARGET_OS_MAC

Posted at

本日二回目の怖いシリーズ。
まずは落ち着いて以下の表を見て欲しい。

参考)
http://stackoverflow.com/questions/15323109/creating-an-ios-os-x-cross-platform-class
http://sealiesoftware.com/blog/archive/2010/8/16/TargetConditionalsh.html

スクリーンショット 2014-02-26 23.16.25.png

MMR どういうこと

なんでiOSデバイスでもTARGET_OS_MACが1なんだよ!!!!

とはいえ、実は以下のように書いても動作します。

#if TARGET_OS_IPHONE
// iOS用
#import <UIKit/UIKit.h>
#elif TARGET_OS_MAC
// OSX用
#import <Cococa/Cococa.h>
#endif

ですがこれは通りません。

#if TARGET_OS_MAC
// OSX用
#import <Cococa/Cococa.h>
#endif

なんでかなーと思ったら、iOS最初の分岐で分かれていたからですね。
((((;゚Д゚))))ガクガクブルブル

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6