我正在尝试开始presentPopoverFromRect
工作,但由于内存访问错误,我一直在崩溃。(EXC_BAD_ACCESS)
.
这是代码,最后一行是它崩溃的地方:
- (void)showChat:(id)sender {
chat = [[PopupChatController alloc] initWithStyle:UITableViewStylePlain];
chat.chatDelegate = self;
self.chatPopover = [[UIPopoverController alloc] initWithContentViewController:chat];
CGRect myRect = CGRectMake(50, 0, 225, 25) ;
[self.chatPopover presentPopoverFromRect:myRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
使用 gdb 我检查了self.view
和的保留计数self.chatPopover
:
例如。
p (int)[self.view retainCount]
他们都很好(> 0)。所以我完全不知道这里发生了什么?
如果有人可以提供帮助,我将不胜感激。
另外,顺便说一句,我在 XCode 中启用了 Zombie Objects (Product > Edit scheme > Diagnostics > Enable Zombie Objects),但我没有在控制台中的任何僵尸变量上获得任何输出。也许我找错地方了?
对此的任何建议也将不胜感激。
提前致谢。