Fabric Crashlytics 偶尔会在调用 CLSLogv 方法时崩溃。崩溃是非常随机的,不确定它崩溃的输入是什么。
这是崩溃日志:
Crashed: com.apple.main-thread
0 CoreFoundation 0x18289d688 __CFStringAppendFormatCore + 12780
1 CoreFoundation 0x18289a464 _CFStringCreateWithFormatAndArgumentsAux2 + 244
2 Foundation 0x1831b6320 -[NSPlaceholderString initWithFormat:locale:arguments:] + 168
3 Dream11 0x1004823e4 CLSLogv (CLSUserLogging.m:368)
4 Dream11 0x1001d73a8 specialized crashlyticsLog(format : String, [CVarArg], file : String, function : String, line : Int) -> () (LogManager.swift)`
这是方法。
func VERBOSELOG(_ format: String = "",
_ args:[CVarArg] = [],
file: String = #file,
function: String = #function,
line: Int = #line) {
if ENABLED_LOGGING.contains("VERBOSE") {
do {
try crashlyticsLog(format: "\nVERBOSE: " + format, args, file: file, function: function, line: line)
} catch let error {
print(error)
}
}
}
func crashlyticsLog(format: String = "",
_ args:[CVarArg] = [],
file: String = #file,
function: String = #function,
line: Int = #line) throws {
let filename = file.components(separatedBy: "/").last!.components(separatedBy: ".").first!
#if SWIFT_DEBUG
print("\(filename).\(function) line \(line) $ \(format)")
#else
CLSLogv("\(filename).\(function) line \(line) $ \(format)", getVaList(args))
#endif
}