Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /var/www/wordpress4/wp-includes/compat.php on line 502

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; MT_Import has a deprecated constructor in /var/www/wordpress4/wp-content/plugins/movabletype-importer/movabletype-importer.php on line 32

Deprecated: Function create_function() is deprecated in /var/www/wordpress4/wp-content/plugins/wp-slimstat/wp-slimstat.php on line 1882

Deprecated: Function create_function() is deprecated in /var/www/wordpress4/wp-content/themes/graphy/inc/widgets.php on line 85

Deprecated: Function create_function() is deprecated in /var/www/wordpress4/wp-content/themes/graphy/inc/widgets.php on line 200
I can’t wait over 20 seconds – NIT-Universe
Notice: Undefined index: country in /var/www/wordpress4/wp-content/plugins/wp-slimstat/wp-slimstat.php on line 557

I can’t wait over 20 seconds

photo by laffy4k(flickr)

BeatmakerというiPhoneアプリが評判がいいので興味が出て買ってみたのだけど、起動してメニューが出ると落ちる。やたらと落ちる。ちゃんとそのあとも使える事もあるのだけど、どちらかというとその時点で落ちてしまう事が多い。すっかり気がそがれてしまったのだけど、よくよく思い起こせば、iPhoneの挙動として日本語予測変換などでしばらく待たされたあとに落ちる事が多い事に気がついた。Safariでもそうだし、OmniFocusでもそうだ。

もしかして、ある一定時間イベントループに戻らないとシステムがタイムアウトとしてプロセスを終了させるのではないかと、そういうカンがふと働いて、これは試してみなくてはということで、簡単にsleepで待ちを発生させるアプリを組んでみる。名付けてiWait。

iPhone OS標準ライブラリのsleepの引数がどうやらmsecでなくsecらしいなど、いろいろ発見もあったけど結論としてタイトルの通り。19秒待ってみると普通に起動できて、20秒以上待つとランチャに戻されてしまう。

秒数等は環境によっても多少増減しそうだけど、なにか一定時間以上反応がないアプリはタイムアウトさせられるという仕組みは組み込まれてそうな感触だ。