我有一个UIWebView,我用来显示几个小PDF.用户从表中选择新闻文章,然后在同一屏幕上的UIWebView中加载文章(PDF).第一次加载总是很好.然后我选择的下一个项目(无论哪一个)崩溃应用程序.
这就是我加载每篇文章的方式:
NSString *filePath = [[NSBundle mainBundle] pathForResource:articleFileName ofType:@"pdf"];
[articleView stopLoading];
[articleView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:filePath]]];
Run Code Online (Sandbox Code Playgroud)
崩溃发生在loadRequest行之后.
崩溃没有提供错误信息.以外:
所有异常{} 0x3629f000
Catchpoint 3(抛出异常).(gdb)
它只是崩溃到main().我已在调试器中验证它在每个请求上使用了正确的文件路径.
我有NSZombies正在运行,我为所有异常设置了断点.
我正在构建一个在两个iPhone之间发送信息的应用程序.该应用程序运行良好,但我遇到的一个问题是,我无法告诉bonjour是否选择Wi-Fi或蓝牙来建立连接.我想让用户能够选择他们喜欢的.此外,有没有办法以编程方式告诉设备的蓝牙是否开启?
我有一个按钮,我正在以编程方式添加到UITableViewCell中,它表现得非常奇怪.
在iOS 6中,它完全按预期工作.在iOS 5x中,它仅响应触摸事件而不是触摸内部事件.甚至触地事件也只会在您按住一两秒后触发.
//Create UIButton
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage:buttonImage forState:UIControlStateNormal];
[button addTarget:self action:@selector(buttonTap) forControlEvents:UIControlEventTouchUpInside];
button.frame = CGRectMake(0, 0, 100, 100);
//Add to UITableViewCell
UITableViewCell *footerCell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"FOOTER_CELL"] autorelease];
[footerCell.contentView addSubview:button];
//Also tried this with just [footerCell addSubview:button];
//Fire Action
- (void)buttonTap {
NSLog(@"Tap");
}
Run Code Online (Sandbox Code Playgroud)
非常标准的问题代码.事实上,我使用这个确切的代码在我的应用程序中的所有位置制作按钮,除了在表格视图中它们都可以工作.必须有一些我不了解细胞结构的东西.