9
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Xcode】iOSシミュレータビルドかどうか判定する

Last updated at Posted at 2017-07-11

はじめに

Xcodeコンパイル時にiOSシミュレータか実機で処理を分けたいケースがあったので備忘録としてまとめました。

サンプルコード

/* Swift */
#if (!arch(i386) && !arch(x86_64))
    // 実機
#else
    // シミュレータ
#endif
/* Objective-C */
#if TARGET_OS_SIMULATOR
    // シミュレータ
#else
    // 実機
#endif

環境

Xcode Version 8.3.3 (8E3004b)

参考

https://blog.ymyzk.com/2015/12/ios-tvos-watchos-architectures/

9
10
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
9
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?