Last active
December 15, 2015 12:38
-
-
Save satoshin2071/5261221 to your computer and use it in GitHub Desktop.
xcode4でDEBUGのプリプロセッサマクロでDEBUGフラグの設定。とprefix.pchの設定。
ついでにRelease ビルドで NSLog() を無効化する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Build Settings > Apple LLVM compiler - Preprocessing > Preprocessor Macros | |
Debug: DEBUG=1 | |
Release: (DEBUG未定義) | |
みたいな感じ設定 | |
コード内で | |
// デバッグ用マクロ | |
#ifdef DEBUG | |
# define LOG(...) NSLog(__VA_ARGS__) | |
# define LOG_CURRENT_METHOD NSLog(@"METHOD: %@/%@", NSStringFromClass([self class]), NSStringFromSelector(_cmd)) | |
#else | |
# define LOG(...) | |
# define LOG_CURRENT_METHOD | |
#endif | |
// こんな漢字に使う | |
LOG_CURRENT_METHOD | |
LOG(@"soko") | |
// 端末のバージョン判定. | |
#define SYSTEM_VERSION_OVER_THAN(v) !([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) | |
// iPhone/iPad判別. | |
#define isPhone ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment