c++ try/catch ignorance in iOS
c++ try/catch ignorance in iOS
在我们的应用程序中,我们有一个c++静态库,我使用objective - c++来处理它。c++库使用rapidjson解析XML数据:
try {
rapidjson::Document document;
document.Parse(connection.data.description);
connection.openTime = document["openFrom"].GetInt();
connection.closeTime = document["openTo"].GetInt();
return true;
} catch (std::exception e) {
connection.openTime = 0;
connection.closeTime = 0;
return false;
}
问题是,如果document["openFrom"]不能通过GetInt()方法转换为Int,则不会引发异常。而不是我的应用程序崩溃的SIGABRT。
Assertion failed: (data_.f.flags & kIntFlag), function GetInt, file /Users/xxx/xxx/xx/ios/../src/rapidjson/document.h, line 1645.
在Android操作系统上,顺便说一句,在相同的情况下,异常会成功引发。有什么问题吗?我猜问题是在Xcode的Swift编译器的行为
正如您提供的日志中明确指出的那样-这不是崩溃,它只是一个内部调用abort()
的失败断言,导致SIGABRT
代表'信号中止'。断言在发布模式下被禁用,所以它应该在那里工作得很好。或者你可以禁用断言在快速json(通过定义宏RAPIDJSON_ASSERT
)。
相关文章:
- netcat command in c++
- Difference in displaying cv2 Mat
- 使用ios:ate写入到流会覆盖现有文件
- C++ MFC Libraries in Travis CI
- 如何在OpenSSL中从configuration.h.in获取configuration.h
- 如何访问RTCVideoRenderer的帧?(ios)
- 创建具有 new in 函数和"this is nullptr"异常的对象
- IN, OUT, INOUT Parameters
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 有人安装"IITB Simplecpp in mac"吗?
- ios::fmtflags 在 C++ 中是如何工作的?setf() 是如何工作的?
- 从 C 样式字符串中删除子字符串 "in place" 在C++代码中
- 如何修复"error: ‘_1’ was not declared in this scope"?
- 我可以在 iOS 或 mac 应用程序中使用C++代码吗?
- 当 std::stringstream 由 ( "some content" , std::ios::in|std::ios::ate) 构造时,tellg() 的预期行为是什么?
- std::ifstream::in 和 std::ios::in 有什么区别?(显然是 C++ 中 std::ifstr
- c++ try/catch ignorance in iOS
- ifstream在二进制模式下打开是否需要ios::in?
- 如何可靠地检测 Mac OS X、iOS、Linux、Windows in C 预处理器
- Std::ios::in 'in' 是 ios 命名空间中的变量吗?