设置exception breakpoint
并调试获取Catchpoint 2的警告消息(抛出异常)。当前语言:auto;目前客观的c
警告:尝试使用不在框架中的块创建USE_BLOCK_IN_FRAME
变量。
(gdb)
这意味着什么。
在我的情况下,在UIToolbar上的mainviewcontroller中有plapause切换按钮,当点击播放音频文件并使用执行选择器一个接一个地加载20个视图控制器
-(void)playpauseAction:(id)sender
{
if
([audioPlayer isPlaying]){
[sender setImage:[UIImage imageNamed:@"play.png"] forState:UIControlStateSelected];
[audioPlayer pause];
} else {
[sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];
[audioPlayer play];
[self performSelector:@selector(displayviewsAction:) withObject:nil afterDelay:11.0];
}
}
- (void)displayviewsAction:(id)sender
{
FirstViewController *viewController = [[FirstViewController alloc] init];
viewController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:viewController.view];
[self.view addSubview:toolbar];
[self performSelector:@selector(secondViewController) withObject:nil afterDelay:23];
[viewController release];
}
-(void)secondViewController {
SecondViewController *secondController = [[SecondViewController alloc] init];
secondController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:secondController.view];
[self.view addSubview:toolbar];
[self performSelector:@selector(ThirdviewController) withObject:nil afterDelay:27];
[secondController release];
}
当只是尝试在模拟器中运行应用程序时它工作正常但是当使用异常断点调试并点击播放按钮开始调试时会收到此警告消息。
任何人都有关于异常断点发生了什么的想法。
答案 0 :(得分:2)
当调试器无法为特定对象创建任何信息结构时,它会发出警告。
以下是一个例子:
NSString* string = [[NSString alloc] initWithUTF8String:line];
在这行代码中,方法initWithUTF8String:期望UTF-8编码的C字符串而不是NSString对象。
所以这次编制者会给USE_BLOCK_IN_FRAME
。
我们应该确保所有的保护措施都得到解决,因为它可能是大错误或应用程序可能在不久的将来崩溃。
更新
-(void)playpauseAction:(id)sender
{
UIButton *btn = (UIButton *)sender;
if([audioPlayer isPlaying]){
[audioPlayer pause];
[btn setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];
} else {
[audioPlayer play];
[btn setImage:[UIImage imageNamed:@"play.png"] forState:UIControlStateNormal];
[self performSelector:@selector(displayviewsAction) withObject:nil afterDelay:11.0];
}
}
- (void)displayviewsAction
{
FirstViewController *viewController = [[FirstViewController alloc] initWithNibName:"FirstViewController"];
viewController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:viewController.view];
[self.view addSubview:toolbar];
[self performSelector:@selector(secondViewController) withObject:nil afterDelay:23];
[viewController release];
}
-(void)secondViewController {
SecondViewController *secondController = [[SecondViewController alloc] init];
secondController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:secondController.view];
[self.view addSubview:toolbar];
[self performSelector:@selector(ThirdviewController) withObject:nil afterDelay:27];
[secondController release];
}