ASi

iOS

cocoapods の pod setup とっても時間がかかる

iOS

フリーズしたのかと思った。5分以上かかったと思われる。

でposix_spawn

iOS

できないかな、と思ったのだけれど、やっぱ塞がれていた。最後のposix_spawnpがエラーになる。同じコードがOSXでは動く。 do { posix_spawn_file_actions_t actions; posix_spawnattr_t attrs; char *args[]={"date", NULL}; int ret; ret = posix_spawn_fil…

GCD の timer

iOS

fire した後でも cancel すると cancel handler が呼ばれる。fire のハンドラからでも cancel できる。 dispatch_source_t createTimer(int msec, void(^fired)(), void(^canceled)()){ dispatch_source_t timersource = dispatch_source_create( DISPATCH_S…

Objective-C の Block の構文

iOS

// variable int (^block_)(id, id); // method param declaration - (void) method: (int(^)(id param1, id param2))block{ block_ = block; } // block declaration [AClass method: ^(id param1, id param2){ return (int)0; }];

プリプロセッサマクロのコマンドライン指定

iOS

xcodebuild に "GCC_PREPROCESSOR_DEFINITIONS=hoge1 hode2=true" の形式で渡す。 Xcode の Build Phases の Run Script で sh なら、 xcodebuild -configuration Release -target MyApp -sdk iphoneos \ "GCC_PREPROCESSOR_DEFINITIONS=\${inherited} $PREP…

Xcodeのデバッグビルドでリンクエラー

iOS

下記のようなリンクエラーがでる場合、 Undefined symbols for architecture armv7s: "_llvm_gcda_emit_function", referenced from: "_llvm_gcda_emit_arcs", referenced from: "_llvm_gcov_init", referenced from: "_llvm_gcda_start_file", referenced f…

UITextViewからどうやって抜けるか

iOS

http://stackoverflow.com/questions/4848086/how-do-i-dismiss-a-uitextview-using-the-done-keyboard-button

@synchronizedの中身

iOS

要はmutexであると。 http://stackoverflow.com/questions/1215330/how-does-synchronized-lock-unlock-in-objective-c

backgroundでのopenURL, DocumentInteraction

iOS

openURL を呼ぶと、自分がハンドルできる場合は自分の UIApplicationDelegateのopenURLが呼ばれる。 が、backgroundでは呼び出し自体が失敗する。 DocumentInteractionControllerのpresentOptionsMenuFromRectはbackgroundでも呼び出せるが、ダイアログはフ…