- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我一直在尝试解决大约 50% 的用户遇到的崩溃问题。在我实现 UISearchDisplayController(即向 TableView 添加搜索栏)后,崩溃开始了,但我无法重现崩溃,一次都没有。根据我的用户的说法,当他们打开具有 UISearchDisplayController 的 TableView 时,他们会立即崩溃(或卡住)。
根据 Crashlytics,崩溃发生在:
-[UISearchDisplayController _updateTableHeaderBackgroundViewInTableView:amountScrolledUnder:]
我以编程方式创建了 UITableView,但我主要通过 IB 添加了 UISearchBar/UISearchDisplayController。
关于崩溃似乎指的“表头背景 View ”,我之前做了两件事。首先,我将 TableView 背景 View 设置为 nil:
[self.tableView setBackgroundView:nil];
其次,我也是这样做的:
- (NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section
{
if (aTableView != nil && self.searchDisplayController != nil)
{
if (self.searchDisplayController.isActive)
{
return nil;
}
else
{
return [super sectionAtIndex:section].headerTitle;
}
}
else
{
return [super sectionAtIndex:section].headerTitle;
}
}
从那以后,我将背景 View 更改为框架大小为 CGZero 的 __strong UIView,这意味着我刚刚向背景添加了一个强大的空 View 。此外,在第二段代码中,我现在返回一个空字符串 @"",而不是返回 nil。
我还没有将这些更改推送给我的用户,因为我想在这样做之前确定一下。尝试用谷歌搜索 UISearchDisplayController 函数,但没有真正找到任何东西,所以我猜这是一个特定于 iOS 7 的问题,这使得它更难追踪,尤其是因为我无法重现它。
无论如何,我希望有人自己遇到过此类问题,或者有人对可能导致此问题的原因有某种想法。
更新:这是完整的崩溃。
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x0000000191f179d0 objc_msgSend + 16
1 UIKit 0x0000000188f63820 -[UISearchDisplayController _updateTableHeaderBackgroundViewInTableView:amountScrolledUnder:] + 164
2 UIKit 0x0000000188f63394 -[UISearchBar _didMoveFromWindow:toWindow:] + 312
3 UIKit 0x0000000188e6e42c -[UIView(Internal) _didMoveFromWindow:toWindow:] + 684
4 UIKit 0x0000000188e9280c -[UIScrollView _didMoveFromWindow:toWindow:] + 68
5 UIKit 0x0000000188e6dba0 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 148
6 UIKit 0x0000000188e6d998 -[UIView(Hierarchy) _postMovedFromSuperview:] + 292
7 UIKit 0x0000000188e7c4ec -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1628
8 UIKit 0x000000018906af44 -[_UIParallaxDimmingView didMoveToWindow] + 144
9 UIKit 0x0000000188e6e768 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1512
10 UIKit 0x0000000188e6e42c -[UIView(Internal) _didMoveFromWindow:toWindow:] + 684
11 UIKit 0x0000000188e6dba0 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 148
12 UIKit 0x0000000188e6d998 -[UIView(Hierarchy) _postMovedFromSuperview:] + 292
13 UIKit 0x0000000188e7c4ec -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1628
14 UIKit 0x000000018906a67c __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 1636
15 UIKit 0x0000000188e82bb8 +[UIView(Animation) performWithoutAnimation:] + 88
16 UIKit 0x0000000189069d54 -[_UINavigationParallaxTransition animateTransition:] + 828
17 UIKit 0x0000000189022078 -[UINavigationController _startCustomTransition:] + 2724
18 UIKit 0x0000000188f2c794 -[UINavigationController _startDeferredTransitionIfNeeded:] + 464
19 UIKit 0x0000000188f2c564 -[UINavigationController __viewWillLayoutSubviews] + 56
20 UIKit 0x0000000188f2c4e4 -[UILayoutContainerView layoutSubviews] + 200
21 UIKit 0x0000000188e6ed78 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 348
22 QuartzCore 0x0000000188a6b0cc -[CALayer layoutSublayers] + 184
23 QuartzCore 0x0000000188a65c94 CA::Layer::layout_if_needed(CA::Transaction*) + 300
24 QuartzCore 0x0000000188a65b4c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
25 QuartzCore 0x0000000188a653d4 CA::Context::commit_transaction(CA::Transaction*) + 280
26 QuartzCore 0x0000000188a65178 CA::Transaction::commit() + 424
27 QuartzCore 0x0000000188a5ea30 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
28 CoreFoundation 0x0000000185f5f7e0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
29 CoreFoundation 0x0000000185f5ca68 __CFRunLoopDoObservers + 372
30 CoreFoundation 0x0000000185f5cdf4 __CFRunLoopRun + 764
31 CoreFoundation 0x0000000185e9db38 CFRunLoopRunSpecific + 452
32 GraphicsServices 0x000000018b8c3830 GSEventRunModal + 168
33 UIKit 0x0000000188edc0e8 UIApplicationMain + 1156
34 Flash Reader 0x00000001000904dc main + 17 (main.m:17)
35 libdyld.dylib 0x0000000192507aa0 start + 4
更新 2:这似乎只发生在 iPhone 5S 上,这也可以解释为什么我无法重现这一点。我有一种感觉,它与这段代码有关:
CGRect newBounds = self.tableView.bounds;
if (self.tableView.bounds.origin.y < 44)
{
newBounds.origin.y = newBounds.origin.y + self.searchDisplayController.searchBar.bounds.size.height;
self.tableView.bounds = newBounds;
}
// new for iOS 7
if (self.tableView != nil && self.staticContentSections.count > 0)
{
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0] atScrollPosition:0 animated:YES];
}
我希望这是导致崩溃的原因,因为如果是这样,我希望通过在 viewWillAppear 中执行此操作来解决此问题:
self.edgesForExtendedLayout = UIRectEdgeNone;
self.tableView.contentOffset = CGPointMake(0, 44);
更新 3:好吧,那并没有解决它。这种情况仍在发生,要么是随机发生,要么是每次用户使用 iPhone 5S 时发生。它不会在 5S 模拟器中发生,但我无法进一步调试它,因为我没有 5S。我开始认为这是一个 iOS 7 错误,而不是应用程序本身的错误。
最佳答案
我在 iOS 8.0 中崩溃了。我通过在 View Controller 的 dealloc(deinit)中设置 searchBar.delegate = nil
来修复它。
关于ios - 随机 UISearchDisplayController 崩溃 (iOS 7),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21237571/
IO 设备如何知道属于它的内存中的值在memory mapped IO 中发生了变化? ? 例如,假设内存地址 0 专用于保存 VGA 设备的背景颜色。当我们更改 memory[0] 中的值时,VGA
我目前正在开发一个使用Facebook sdk登录(通过FBLoginView)的iOS应用。 一切正常,除了那些拥有较旧版本的facebook的人。 当他们按下“使用Facebook登录”按钮时,他
假设我有: this - is an - example - with some - dashesNSRange将使用`rangeOfString:@“-”拾取“-”的第一个实例,但是如果我只想要最后
Card.io SDK提供以下详细信息: 卡号,有效期,月份,年份,CVV和邮政编码。 如何从此SDK获取国家名称。 - (void)userDidProvideCreditCardInfo:(Car
iOS 应用程序如何从网络服务下载图片并在安装过程中将它们安装到用户的 iOS 设备上?可能吗? 最佳答案 您无法控制应用在用户设备上的安装,因此无法在安装过程中下载其他数据。 只需在安装后首次启动应
我曾经开发过一款企业版 iOS 产品,我们公司曾将其出售给大型企业,供他们的员工使用。 该应用程序通过 AppStore 提供,企业用户获得了公司特定的配置文件(包含应用程序配置文件)以启用他们有权使
我正在尝试将 Card.io SDK 集成到我的 iOS 应用程序中。我想为 CardIO ui 做一个简单的本地化,如更改取消按钮标题或“在此保留信用卡”提示文本。 我在 github 上找到了这个
我正在使用 CardIOView 和 CardIOViewDelegate 类,没有可以设置为 YES 的 BOOL 来扫描 collectCardholderName。我可以看到它在 CardIOP
我有一个集成了通话工具包的 voip 应用程序。每次我从我的 voip 应用程序调用时,都会在 native 电话应用程序中创建一个新的最近通话记录。我在 voip 应用程序中也有自定义联系人(电话应
iOS 应用程序如何知道应用程序打开时屏幕上是否已经有键盘?应用程序运行后,它可以接收键盘显示/隐藏通知。但是,如果应用程序在分屏模式下作为辅助应用程序打开,而主应用程序已经显示键盘,则辅助应用程序不
我在模拟器中收到以下错误: ImageIO: CGImageReadSessionGetCachedImageBlockData *** CGImageReadSessionGetCachedIm
如 Apple 文档所示,可以通过 EAAccessory Framework 与经过认证的配件(由 Apple 认证)进行通信。但是我有点困惑,因为一些帖子告诉我它也可以通过 CoreBluetoo
尽管现在的调试器已经很不错了,但有时找出应用程序中正在发生的事情的最好方法仍然是古老的 NSLog。当您连接到计算机时,这样做很容易; Xcode 会帮助弹出日志查看器面板,然后就可以了。当您不在办公
在我的 iOS 应用程序中,我定义了一些兴趣点。其中一些有一个 Kontakt.io 信标的名称,它绑定(bind)到一个特定的 PoI(我的意思是通常贴在信标标签上的名称)。现在我想在附近发现信标,
我正在为警报提示创建一个 trigger.io 插件。尝试从警报提示返回数据。这是我的代码: // Prompt + (void)show_prompt:(ForgeTask*)task{
您好,我是 Apple iOS 的新手。我阅读并搜索了很多关于推送通知的文章,但我没有发现任何关于 APNS 从 io4 到 ios 6 的新更新的信息。任何人都可以向我提供 APNS 如何在 ios
UITabBar 的高度似乎在 iOS 7 和 8/9/10/11 之间发生了变化。我发布这个问题是为了让其他人轻松找到答案。 那么:在 iPhone 和 iPad 上的 iOS 8/9/10/11
我想我可以针对不同的 iOS 版本使用不同的 Storyboard。 由于 UI 的差异,我将创建下一个 Storyboard: Main_iPhone.storyboard Main_iPad.st
我正在写一些东西,我将使用设备的 iTunes 库中的一部分音轨来覆盖 2 个视频的组合,例如: AVMutableComposition* mixComposition = [[AVMutableC
我创建了一个简单的 iOS 程序,可以顺利编译并在 iPad 模拟器上运行良好。当我告诉 XCode 4 使用我连接的 iPad 设备时,无法编译相同的程序。问题似乎是当我尝试使用附加的 iPad 时
我是一名优秀的程序员,十分优秀!