Gab*_*ele 17 cocoa-touch objective-c stack-trace uialertview ios
我的应用程序崩溃了,它必须是因为UIAlertController.
仅在UIAlertController可用的iOS 8.x上会出现此问题.奇怪的是,我的应用程序不使用UIAlertViewController或UIAlertView.
报告告诉我:
Trying to dismiss UIAlertController <UIAlertController: 0x172c5d80> with unknown presenter.
Run Code Online (Sandbox Code Playgroud)
怎么会发生这种情况?
我想过
但是没有一个案例让我陷入崩溃.
崩溃日志告诉我的是,操作系统显示一个AlertView,它将附加到我的应用程序窗口,在某些情况下,松散了呈现UIAlertViewController的父视图控制器.
任何想法如何找到问题?
这里是堆栈跟踪
_________________________________
0 CoreFoundation 0x2bc0c45f __exceptionPreprocess + 127
1 libobjc.A.dylib 0x39c79c8b objc_exception_throw + 36
2 CoreFoundation 0x2bc0c3a5 +[NSException raise:format:] + 110
3 UIKit 0x2f4ad13d -[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:] + 414
4 UIKit 0x2f4acf97 -[UIAlertController _dismissAnimated:triggeringAction:] + 28
5 UIKit 0x2f590a0b -[_UIAlertControllerActionView touchesEnded:withEvent:] + 160
6 UIKit 0x2f159567 -[UIWindow _sendTouchesForEvent:] + 520
7 UIKit 0x2f152e31 -[UIWindow sendEvent:] + 542
8 UIKit 0x2f129759 -[UIApplication sendEvent:] + 194
9 UIKit 0x2f39d2f9 _UIApplicationHandleEventFromQueueEvent + 14166
10 UIKit 0x2f1281a9 _UIApplicationHandleEventQueue + 1350
11 CoreFoundation 0x2bbd2fbf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
12 CoreFoundation 0x2bbd23cf __CFRunLoopDoSources0 + 216
13 CoreFoundation 0x2bbd0a35 __CFRunLoopRun + 770
14 CoreFoundation 0x2bb1e3b1 CFRunLoopRunSpecific + 474
15 CoreFoundation 0x2bb1e1c3 CFRunLoopRunInMode + 104
16 GraphicsServices 0x3308d201 GSEventRunModal + 134
17 UIKit 0x2f18843d UIApplicationMain + 1438
18 MyApp 0x00028a07 main (main.mm:16)
Run Code Online (Sandbox Code Playgroud)
编辑
洞问我的窗户初始化.这是我的AppDelegate的代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[MyAppCustomWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
_mainViewController = [[MyAppContainerViewController alloc] initWithNibName:nil bundle:nil];
_mainStatusBarVC = [[MyAppStatusBarVC alloc] initWithRootVC:_mainViewController];
[self.window setRootViewController:_mainStatusBarVC];
[self.window makeKeyAndVisible];
return YES;
}
Run Code Online (Sandbox Code Playgroud)
这种形式的堆栈跟踪通常表明您已离开 UIViewController,而有关它存在的警报仍在消除。
一般的补救措施是在 UIAlertViewDelegate 的alertView:didDismissWithButtonIndex: 方法中显示或关闭控制器,从那时起,您就可以确定演示者在任何关闭过程中都不会消失。
在你的情况下,如果你找不到任何可重现的情况,你可以尝试在呈现/关闭控制器之前检查presentedViewController,看看是否会出现任何问题。
但如果您审核控制器转换,您可能会发现响应系统警报可以以编程方式触发导航的地方。您是否有任何功能可以向用户授权(例如访问照片或其他内容)发出系统警报,并且他们否认它会导致控制器被您的错误处理以编程方式解雇?这似乎是一个相当合理的场景。
| 归档时间: |
|
| 查看次数: |
2385 次 |
| 最近记录: |