ifdefとかのマクロ

iOSアプリを開発している人にはおなじみであろうマクロ #ifdef DEBUG // do something #endif Xcodeでプロジェクトを作成するとDebugビルドにはDEBUGがPreprocessor Macrosの初期値として設定されているので使用している人は多いと思う。 この#ifdefとかに混ざって#ifも使われていたりしてマクロがカオスになっているソースがたまにある。 ということで検証 // フラグ作成 #define TEST_FLG 1 // ifdefの場合 #ifdef TEST_FLG NSLog(@"ifdef TEST_FLG Success"); #else NSLog(@"ifdef TEST_FLG Failure"); #endif // TEST_FLG // ifの場合 #if TEST_FLG NSLog(@"if TEST_FLG Success"

ssh鍵認証で毎回パスワードを求められた

githubのアカウントを作成してssh鍵認証の接続確認をした。認証確認のためのプロジェクトを作成してcloneとpushが確認できればいいや。 鍵を作る。githubに書かれてたコマンドのままでok。秘密鍵の名前はid_rsa_githubとした。 $ ssh-keygen -t rsa -C "[email protected] " # 鍵を作る Generating public/private rsa key pair. Enter file in which to save the key (/Users/user/.ssh/id_rsa): id_rsa_github Enter passphrase (empty for no passphrase): Enter same passphrase again:

iOS8のFontFamilyName

iOS9はこちら 取得方法 familyNameからfontNameを取得する。 for (NSString *familyName in [UIFont familyNames]) { for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) { NSLog(@"%@", fontName); } } 確認環境 iPhone Simulator (iOS8.2) 結果抜粋 Marion-Italic Marion-Bold Marion-Regular Copperplate-Light Copperplate Copperplate-Bold STHeitiSC-Medium STHeitiSC-Light IowanOldStyle-Italic IowanOldStyle-Roman IowanOldStyle-BoldItalic IowanOldStyle-Bold CourierNewPS-BoldMT CourierNe

IBInspectableを使ったらエラーが出た

IBInspectableを使うとInterfacebuilderがよしなに表示を変えてくれるとかいうのは知ってた(試しに使ったことはあった程度だった)けど、IBInspectableを使っているライブラリがあったので使ってみた。 IB Designables Failed to render instance of XXX: Rendering the view took longer than 200ms. Your drawing code may suffer from slow... こんな感じのエラーが出た。xibファイルが無駄に複雑で巨大なせいでレンダリングが遅い画面だったけど、IBInspectableを使った結果余計なエラーが出るようになった。 もちろんビルドには問題ない。ただ気持ち悪いだけで。