(1) ビルド フォルダーのクリーニング、
(2) シミュレーターと iPhone からのアプリの削除、
(3) 再起動、 (4) NSZombieEnabled の有効化を試し
ましたが、何もしていないようです。
(5) デバッガ lldb と gdb
(6) と gaurd malloc を使用
私はxcode 4.3.2を持っています。このバグは、シミュレーターと私の iPhone の両方で発生します。(シミュレーターではEXC_BAD_INSTRUCTION code=i386 subcode=0x0
、デバイスでは と表示され
ます。2 つのクラッシュ ログを次に示しますEXC_BREAKPOINT (SIGTRAP)
。
ログには次のように出力されます。
Trace/BPT trap: 5
Segmentation fault: 11
クラッシュでわかるように、ViewController へのトレースバックはありません。質問する前にたくさんのグーグル検索を行いましたが(リンク)、このエラーを抱えている他の多くの人(リンク) は、アプリへのトレースバックを持っています。このアプリの一般的な原因は何ですか? どこからバグを探す必要がありますか? 再現するためにできることは1つもありません。コードの一部を10回実行するだけで、少なくとも1回はクラッシュします。ありがとう!
編集:いくつかのコードがあります
outputPipe = [[NSPipe alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getDataOut:) name:NSFileHandleReadToEndOfFileCompletionNotification object:[outputPipe fileHandleForReading]];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleReadToEndOfFileCompletionNotification object:[outputPipe fileHandleForReading]];
コードの後半で outputPipe をリリースします。
編集 2: [NSPipe パイプ] の変更; [[NSPipe alloc] init] に; 修正しませんでした。
オブザーバーを切り替えるコード:
buttondone.title=@"Done";
//dlog(@"last output notification inbound");
stdoutisdone=YES;
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleReadCompletionNotification object:[outputPipe fileHandleForReading]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getDataOut:) name:NSFileHandleReadToEndOfFileCompletionNotification object:[outputPipe fileHandleForReading]];
[[outputPipe fileHandleForReading] readToEndOfFileInBackgroundAndNotify];