是否可以在 iOS 设备本身中获取崩溃日志而不使用崩溃报告工具、AppStore 等

Is it possible to get crash logs with in the iOS device itself with out using crash reporting tools , AppStore etc

我正在创建动态框架并提供给客户。我也不会将我的 .dsym 文件提供给任何人。 客户端应用程序在发生崩溃时会报告崩溃情况,将查看堆栈跟踪并找到根本原因..这似乎工作正常。

但我想知道是否有可能我可以编写一些逻辑并从设备获取崩溃日志并将其存储在某些工具中..

崩溃日志究竟存储在设备(目录)中的什么位置? 崩溃报告工具如何以及从何处崩溃? 如果我在 SDK 中使用 Hockey 源代码,是否可以获得崩溃日志?

是的,你可以。您可以在 AppDelegate.m 文件

中添加此方法
-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:  
(NSDictionary*)launchOptions {   

    NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler); 
}

然后在同一个 AppDelegate 文件中创建一个方法,

void uncaughtExceptionHandler(NSException *exception) { 

    NSLog(@"CRASH: %@", exception);      
    NSLog(@"Stack Trace: %@", [exception callStackSymbols]);    
}

现在您拥有来自 uncaughtExceptionHandler 方法的崩溃日志。您可以将其保存在您的目录中,以便在用户下次打开您的应用程序时将它们发送到您的服务器。

希望对您有所帮助。