背景:
我的所有OpenTok方法都ViewController被推入视图中,就像典型的Master/detail VC关系一样.detailVC根据您的选择将您连接到不同的房间.当我按下后退按钮弹出视图时,我发生了崩溃(可能是7次中的1次):
[OTMessenger setRumorPingForeground] message sent to deallocated instance xxxxx
Run Code Online (Sandbox Code Playgroud)
要么
[OTSession setSessionConnectionStatus:]: message sent to deallocated instance 0x1e1ee440
Run Code Online (Sandbox Code Playgroud)
我在viewDidDisappear中放置了取消发布/断开连接方法:
-(void)viewDidDisappear:(BOOL)animated{
//dispatch_async(self.opentokQueue, ^{
[self.session removeObserver:self forKeyPath:@"connectionCount"];
if(self.subscriber){
[self.subscriber close];
self.subscriber = nil;
}
if (self.publisher) {
[self doUnpublish];
}
if (self.session) {
[self.session disconnect];
self.session = nil;
}
//});
[self doCloseRoomId:self.room.roomId position:self.room.position];
}
Run Code Online (Sandbox Code Playgroud)
这是一个痕迹:

这是Github上的DetailViewController:链接在这里
如何重现:
从MasterVC中进行选择,将您带入DetailVC,立即尝试连接到会话并发布
通常在会话有机会发布流之前,快速回到之前的MasterVC
试试几次,最终会崩溃.
如果我放慢速度并允许发布者有机会进行连接和发布,则不太可能导致崩溃.
预期结果:
它应该断开会话/取消发布并开始一个新的会话,因为我在Master/DetailVC之间来回走动.
其他:
您的设备和操作系统版本是什么?iOS 6
你在什么类型的连接?无线上网
僵尸已启用?是
ARC启用了吗?是
代表们定为零?是的,据我所知
任何帮助解决此崩溃将非常感激.也许我错过了一些我根本无法看到的基本知识.
似乎发生的事情是OpenTok库中的OTSession对象继续向该库中的对象发送消息,这些对象已经被切换视图解除分配.该库有一个[会话断开]方法,如果你给它足够的时间,它可以正常工作,但它需要接近2-3秒,这是在视图之间暂停应用程序的很长时间.
这可能是一个愚蠢的问题,但是:无论如何都要停止某个VC启动的所有进程?
我知道有两种情况会导致以下错误:
ld: warning: instance method 'resetAudioSystem' in category from /opentok-ios-sdk/Opentok.framework/Opentok(OTPublisher+AudioSnoop.o) conflicts with same method from another category
ld: warning: instance method 'attachAudioSnoopBlock:' in category from /opentok-ios-sdk/Opentok.framework/Opentok(OTPublisher+AudioSnoop.o) conflicts with same method from another category
ld: warning: instance method 'setVideoSnoopDelegate:' in category from /opentok-ios-sdk/Opentok.framework/Opentok(OTPublisher+VideoSnoop.o) conflicts with same method from another category
Run Code Online (Sandbox Code Playgroud)
可能性1:类别实例方法被声明两次.(在此描述:SO)
但是,当我搜索3个实例方法中的任何一个(在Xcode或Grep中)时,我发现它没有被声明两次.
可能性2:意外导入.m文件.(在此描述:SO)
但是,我检查了所有的导入,我只在整个项目中导入一次框架.此外,仅在Build Phases中显示一次.
我的程序在没有崩溃的情况下运行,可能是因为使用了添加的最后一个类别定义并且它恰好是正确的.(来源)
问题1:在添加之前,有没有办法告诉两个类别的位置?
问题2:关于如何解决这个问题的任何其他想法?
注意:Opentok Framework是一个二进制文件
发生在:
xcode 4.6&xcode 5
iOS6和iOS7