I have an iOS voip app that utilizes the Linphone library. Previously the app was running successfully but I have just upgraded the linphone frameworks and files: LinphoneManager.h/.m and Utils.h/.m from linphone-iphone.
After adding the updated frameworks from a new version of the linphone-sdk and updating LinphoneManager.h/m I am running into a crash on startup of the application. The crash occurs once the app hits
lp_config_get_string(_configDb, [section UTF8String], [key UTF8String], NULL);
in lpConfigStringForKey().
I have tried removing and readding the frameworks and checking the LinphoneManager.h/.m code but I have not come across a solution nor have I found any instances similar to mine in the linphone-iphone issues.
The crash occurs as it hits the following block of code
- (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;
}
This is a standard function in LinphoneManager.m that I have not modified.
Specifically, the crash comes from this function in the linphone framework:
lp_config_get_string(_configDb, [section UTF8String], [key UTF8String], NULL);
I have logged the key, section and defaultValue variables when the app crashes. They are:
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)
The header comments for the linphone_config_get_string which is what lp_config_get_string points to are the following:
/**
* 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);
Here is a screenshot of the error and crash: Crash stack trace and error
I figure I am missing something when adding the frameworks but I haven't been able to find it yet.
Thank you
I found the issue. The following was missing from the init function:
[self renameDefaultSettings];
[self copyDefaultSettings];
[self overrideDefaultSettings];
Which was causing some issues with the lp_config