これが役立つかどうかはわかりませんが、私のアプリでは、次UIAlertView
のように、クラッシュ、例外の種類、その説明、およびスタック トレース (すべてNSSetUncaughtExceptionHandler
メソッドを使用)についてユーザーに説明を表示することができました。

次に、アプリを強制終了するか、アプリが不安定な場合でも続行するという推奨オプションを提供します。私の場合、アプリの機能に部分的に影響したため、ほとんどの場合、ユーザーは作業を保存してアプリを安全に閉じることができました。
必要に応じて、回答を編集してここにコードを投稿できます (Xcode プロジェクト フォルダーを検索する必要があるため、投稿していません)。
編集:
AppDelegate デリゲートのメソッドwillFinishLaunchingWithOptions
で、NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
次に、次のようにハンドラー メソッドを作成します。
static void uncaughtExceptionHandler(NSException *exception)
{
[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"kDisculpe", nil) message:[NSString stringWithFormat:@"%@ %@%@ %@%@ %@", NSLocalizedString(@"kErrorText", nil), [exception name], NSLocalizedString(@"kErrorDescripcion", nil), [exception reason], NSLocalizedString(@"kErrorTrazaPila", nil), [exception callStackReturnAddresses]] delegate:[[UIApplication sharedApplication] delegate] cancelButtonTitle:NSLocalizedString(@"kContinuar", nil) otherButtonTitles:NSLocalizedString(@"kSalir", nil), nil] show];
[[NSRunLoop currentRunLoop] run];
}
次に、AlertView のデリゲート メソッドで次のようclickedButtonAtIndex
に設定しました。
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if ([[alertView title] isEqualToString:NSLocalizedString(@"kDisculpe", nil)]) {
switch (buttonIndex) {
case 0:
if ([[alertView title] isEqualToString:NSLocalizedString(@"kDisculpe", nil)]) {
[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"kAdvertencia", nil) message:NSLocalizedString(@"kAppContinuaraInestable", nil) delegate:[[UIApplication sharedApplication] delegate] cancelButtonTitle:NSLocalizedString(@"kContinuar", nil) otherButtonTitles:nil] show];
}
break;
case 1:
exit(0);
break;
}
}
}
私が行った唯一の重要なことは、[[NSRunLoop currentRunLoop] run];
これがお役に立てば幸いです.