Skip to content

Instantly share code, notes, and snippets.

@hannesoid
Created August 17, 2015 13:51
Show Gist options
  • Save hannesoid/d43dc8217031b1bd4c7c to your computer and use it in GitHub Desktop.
Save hannesoid/d43dc8217031b1bd4c7c to your computer and use it in GitHub Desktop.
Resolve crash on jenkins due to combination of KIWI class loading and OpenTok 2.4.1 Audio initializiation
//
// OpenTokObjC+Silencer.m
//
// Created by Hannes Oud on 17.08.15.
//
#if TEST
extern void otk_console_set_logger(void(*)(const char*));
void logger (const char* a) { /* empty logging */ }
@interface OpenTokObjC : NSObject
@end
@interface OpenTokObjC (Silencer)
@end
/**
OpenTok crashes on Jenkins, when KIWI loads all classes and induces initialize, where OpenTok initializes Audio, which doesn't work on Jenkins, mostly. The following hack prevents OpenTok from doing it's black magic. Also we remove a logging-warning.
Compile this with each Test Target.
*/
@implementation OpenTokObjC (Silencer)
+ (void)initialize
{
// opentok, please do nothing
}
+ (void)load
{
// prevent OpenTok from loading and initializing. Instead, also set the logger, so no warnings appear in console
otk_console_set_logger(logger);
}
@end
#endif
@pratibha-bhandari
Copy link

Hi,

Your code is in objective c but I want to set otk_console_set_logger in swift as I am getting below error in swift Basic Video sample app.

NOTICE: OPENTOK CONSOLE LOGGER HAS NOT BEEN SET.
PLEASE USE otk_console_set_logger(otk_console_logger)
TO SET YOUR LOGGER
Can you please help me on this. it's urgent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment