Interface Builder 文件中的未知 class OTKTextChatView ios
Unknown class OTKTextChatView in Interface Builder file in ios
我在我的 iOS 应用程序中集成了用于聊天功能的 TokBox。
我用过这个link
这是我的代码
- (void)sessionDidConnect:(OTSession*)session {
// When we've connected to the session, we can create the chat component.
// crash on following line
_textChat = [[OTKTextChatComponent alloc] init];
_textChat.delegate = self;
[_textChat setMaxLength:1050];
[_textChat setSenderId:session.connection.connectionId alias:session.connection.data];
CGRect r = self.view.bounds;
r.origin.y += 20;
r.size.height -= 20;
[_textChat.view setFrame:r];
[self.view addSubview:_textChat.view];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
// fade in
_textChat.view.alpha = 0;
[UIView animateWithDuration:0.5 animations:^() {
//_connectingLabel.alpha = 0;
_textChat.view.alpha = 1;
}];
}
此演示运行良好。但是当我试图将它集成到我的项目中时。它给出以下错误:
Unknown class OTKTextChatView in Interface Builder file.
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIView 0x7f8c43835fa0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key countLabel.'
*** First throw call stack:
请帮帮我
这是因为 OTKTextChatView
class 在 xib 加载之前没有加载(因为它在外部库中)。通常我们设置 -all_load
,但在文档中它说
Do not use the -all_load
linker flag. Instead, use the -force_load
linker flag to load specific libraries that require it.
如果这没有帮助,请尝试在您的应用程序中添加以下代码完成启动方法
[OTKTextChatView class];
这将强制加载 OTKTextChatView
class.
这对你有帮助。
根据 Maulik 的建议:-
添加这三个库 OTKTextChatLibrary,OTKTextChatBundle & OTKTextChatBundle.bundle..如果你不添加这个就会出现这种类型的错误
我在我的 iOS 应用程序中集成了用于聊天功能的 TokBox。
我用过这个link
这是我的代码
- (void)sessionDidConnect:(OTSession*)session {
// When we've connected to the session, we can create the chat component.
// crash on following line
_textChat = [[OTKTextChatComponent alloc] init];
_textChat.delegate = self;
[_textChat setMaxLength:1050];
[_textChat setSenderId:session.connection.connectionId alias:session.connection.data];
CGRect r = self.view.bounds;
r.origin.y += 20;
r.size.height -= 20;
[_textChat.view setFrame:r];
[self.view addSubview:_textChat.view];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
// fade in
_textChat.view.alpha = 0;
[UIView animateWithDuration:0.5 animations:^() {
//_connectingLabel.alpha = 0;
_textChat.view.alpha = 1;
}];
}
此演示运行良好。但是当我试图将它集成到我的项目中时。它给出以下错误:
Unknown class OTKTextChatView in Interface Builder file.
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIView 0x7f8c43835fa0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key countLabel.'
*** First throw call stack:
请帮帮我
这是因为 OTKTextChatView
class 在 xib 加载之前没有加载(因为它在外部库中)。通常我们设置 -all_load
,但在文档中它说
Do not use the
-all_load
linker flag. Instead, use the-force_load
linker flag to load specific libraries that require it.
如果这没有帮助,请尝试在您的应用程序中添加以下代码完成启动方法
[OTKTextChatView class];
这将强制加载 OTKTextChatView
class.
这对你有帮助。
根据 Maulik 的建议:- 添加这三个库 OTKTextChatLibrary,OTKTextChatBundle & OTKTextChatBundle.bundle..如果你不添加这个就会出现这种类型的错误