我有一个利用 Linphone 库的 iOS voip 应用程序。以前该应用程序运行成功,但我刚刚升级了 linphone 框架和文件: LinphoneManager.h/.m 和 Utils.h/.m 从linphone-iphone。
从新版本的 linphone-sdk 添加更新的框架并更新 LinphoneManager.h/m 后,我在应用程序启动时遇到了崩溃。一旦应用程序命中,就会发生崩溃
lp_config_get_string(_configDb, [section UTF8String], [key UTF8String], NULL);
在 lpConfigStringForKey() 中。
我已经尝试删除和读取框架并检查 LinphoneManager.h/.m 代码,但我没有遇到解决方案,也没有在 linphone-iphone 问题中找到任何与我类似的实例。
崩溃发生在它遇到以下代码块时
- (NSString *)lpConfigStringForKey:(NSString *)key inSection:(NSString *)section withDefault:(NSString *)defaultValue {
if (!key) {
return defaultValue;
}
const char *value = lp_config_get_string(_configDb, [section UTF8String], [key UTF8String], NULL);
return value ? [NSString stringWithUTF8String:value] : defaultValue;
}
这是 LinphoneManager.m 中的一个标准函数,我没有修改。
具体来说,崩溃来自linphone框架中的这个函数:
lp_config_get_string(_configDb, [section UTF8String], [key UTF8String], NULL);
当应用程序崩溃时,我已经记录了 key、section 和 defaultValue 变量。他们是:
2019-07-11 10:58:51.033849-0500 myApp[15512:511705] KEY: debugenable_preference
2019-07-11 10:58:51.033964-0500 myApp[15512:511705] SECTION: app
2019-07-11 10:58:51.034040-0500 myApp[15512:511705] DEFAULT: (null)
lp_config_get_string 指向的 linphone_config_get_string 的标题注释如下:
/**
* Retrieves a configuration item as a string, given its section, key, and default value.
*
* The default value string is returned if the config item isn't found.
**/
LINPHONE_PUBLIC const char *linphone_config_get_string(const LinphoneConfig *lpconfig, const char *section, const char *key, const char *default_string);
这是错误和崩溃的屏幕截图: 崩溃堆栈跟踪和错误
我想我在添加框架时遗漏了一些东西,但我还没有找到它。
- 注意 - 如果我注释掉 lp_config_get_string 调用,那么当应用程序进入下一个 lp_config 函数调用时,它会在那里崩溃。所以看起来它与 linphone.framework 和 lp_config 模块有关,但我还没有找到解决方案。
谢谢