段框架使UIAlertController崩溃

段框架使UIAlertController崩溃

本文介绍了段框架使UIAlertController崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循在我的iOS源代码上实施分析用户使用情况。但是,当我使用 UIAlertController 显示标题为@的警报时,我的应用程序崩溃了!我不知道为什么。要解决它,我必须设置警报的标题为零。这是我的日志:

  2016-11-10 17:12:57.185 Lightning Rider Partner [24434:236155] ** * SEGAnalytics屏幕:属性:选项:(),/Users/dungdo/Desktop/tcourier-ios/v2_driver/Pods/Analytics/Analytics/Classes/SEGAnalytics.m:323 
2016-11中断言失败-10 17:12:57.192 Lightning Rider Partner [24434:236155] ***由于未捕获异常'NSInternalInconsistencyException',原因:'screen name()不能为空'
***第一次抛出调用堆栈:

0 CoreFoundation 0x000000010c1f134b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00000001120f521e objc_exception_throw + 48
2 CoreFoundation 0x000000010c1f5442 + [NSException raise:format:arguments:] + 98
3 Foundation 0x0000000111cc1d79 - [NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
4 Analytics 0x000000010bc29d37 - [SEGAnalytics screen:properties:options:] + 471
5分析0x000000010bc3fb7c - [UIViewController(SEGScreen)seg_viewDidAppear:] + 444
6 UIKit 0x000000010e50eb0c - [UIViewController _setViewAppearState:isAnimating:] + 945
7分配的UIKit 0x000000010e51187a __64- [UIViewController中viewDidMoveToWindow:shouldAppearOrDisappear:] _ block_invoke + 42
8分配的UIKit 0x000000010e50fb64 - [UIViewController中_executeAfterAppearanceBlock] + 86
9分配的UIKit 0x000000010e374438 _runAfterCACommitDeferredBlocks + 653
10分配的UIKit 0x000000010e360f6f _cleanUpAfterCAFlushAndRunDeferredBlocks + 566
11 UIKit 0x000000010e3923da _afterCACommitHandler + 176
12 CoreFoundation 0x000000010c195e17 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
13分配的CoreFoundation 0x000000010c195d87 __CFRunLoopDoObservers + 391
14分配的CoreFoundation 0x000000010c17ab9e __CFRunLoopRun + 1198
15分配的CoreFoundation 0x000000010c17a494 CFRunLoopRunSpecific + 420
16个分配GraphicsServices 0x0000000115145a6f GSEventRunModal + 161
17分配的UIKit 0x000000010e367964 UIApplicationMain + 159
18 Lightning Rider合作伙伴0x000000010ad74c3f main + 111
19 libdyld.dylib 0x00000001128a868d start + 1

libc ++ abi.dylib:以NSException类型的未捕获异常


解决方案

我在使用Segment框架时遇到同样的问题。

我只是评论SDK文件中的Assert语句为空屏幕。请在整个项目中搜索下面的内容并注释掉。



NSCAssert1(screenTitle.length> 0,@screen name(%@)must not be空,screenTitle);



你很好去。


I follow "https://segment.com/" to implement analytics user usage on my iOS source. But when i use UIAlertController to show alert with title is @"", my app was crash! I don't know exactly why. To solve it, i must set title of alert is nil. And this is my logs:

2016-11-10 17:12:57.185 Lightning Rider Partner[24434:236155] *** Assertion failure in -[SEGAnalytics screen:properties:options:](), /Users/dungdo/Desktop/tcourier-ios/v2_driver/Pods/Analytics/Analytics/Classes/SEGAnalytics.m:323
2016-11-10 17:12:57.192 Lightning Rider Partner[24434:236155] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'screen name () must not be empty.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010c1f134b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00000001120f521e objc_exception_throw + 48
    2   CoreFoundation                      0x000000010c1f5442 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x0000000111cc1d79 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
    4   Analytics                           0x000000010bc29d37 -[SEGAnalytics screen:properties:options:] + 471
    5   Analytics                           0x000000010bc3fb7c -[UIViewController(SEGScreen) seg_viewDidAppear:] + 444
    6   UIKit                               0x000000010e50eb0c -[UIViewController _setViewAppearState:isAnimating:] + 945
    7   UIKit                               0x000000010e51187a __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke + 42
    8   UIKit                               0x000000010e50fb64 -[UIViewController _executeAfterAppearanceBlock] + 86
    9   UIKit                               0x000000010e374438 _runAfterCACommitDeferredBlocks + 653
    10  UIKit                               0x000000010e360f6f _cleanUpAfterCAFlushAndRunDeferredBlocks + 566
    11  UIKit                               0x000000010e3923da _afterCACommitHandler + 176
    12  CoreFoundation                      0x000000010c195e17 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    13  CoreFoundation                      0x000000010c195d87 __CFRunLoopDoObservers + 391
    14  CoreFoundation                      0x000000010c17ab9e __CFRunLoopRun + 1198
    15  CoreFoundation                      0x000000010c17a494 CFRunLoopRunSpecific + 420
    16  GraphicsServices                    0x0000000115145a6f GSEventRunModal + 161
    17  UIKit                               0x000000010e367964 UIApplicationMain + 159
    18  Lightning Rider Partner             0x000000010ad74c3f main + 111
    19  libdyld.dylib                       0x00000001128a868d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
解决方案

I was getting the same issue while using the Segment framework.

I just comment the Assert statement in SDK file for empty screen. Please search line below in your whole project and comment it out.

NSCAssert1(screenTitle.length > 0, @"screen name (%@) must not be empty.", screenTitle);

You are good to go.

这篇关于段框架使UIAlertController崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 23:57