1

我有一个UITextField接受用户输入来搜索服务器端的内容。只需输入英文就一切顺利。当我尝试输入中文时,应用程序崩溃了(但不是每次都崩溃)。

我得到以下堆栈跟踪:

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   CoreGraphics                    0x33a72568 argb32_image_mark + 1732
1   CoreGraphics                    0x33a97f6c argb32_shade + 380
2   libRIP.A.dylib                  0x33dd625c ripl_BltShade + 1116
3   libRIP.A.dylib                  0x33dd578c ripc_DrawShading + 4812
4   CoreGraphics                    0x33a9738e CGContextDrawLinearGradient + 170
5   UIKit                           0x35915a4a UIKBDrawLinearGradient + 38
6   UIKit                           0x35c63abe -[UIKeyboardCandidateUnsplitKeyboardToggleButton toggleButtonBackgroundImageWithHighlight:] + 302
7   UIKit                           0x35c63938 -[UIKeyboardCandidateUnsplitKeyboardToggleButton updateBackgroundImages] + 48
8   UIKit                           0x35c63bd4 -[UIKeyboardCandidateUnsplitKeyboardToggleButton setDrawsBackground:] + 44
9   UIKit                           0x35c636e8 -[UIKeyboardCandidateUnsplitKeyboardToggleButton initWithFrame:] + 108
10  UIKit                           0x35bc05ca -[UIKeyboardCandidateGridHeader initWithFrame:] + 434
11  UIKit                           0x35c605e0 -[UIKeyboardCandidateView_iPhone_Bar initWithFrame:] + 324
12  UIKit                           0x35c5ed72 +[UIKeyboardCandidateView sharedInstance] + 242
13  UIKit                           0x35a5022c -[UIKeyboardImpl updateTextCandidateView] + 340
14  UIKit                           0x358fd648 -[UIKeyboardImpl setCandidates:] + 296
15  UIKit                           0x35a4fda2 -[UIKeyboardImpl updateCandidateDisplayAsyncWithCandidates:forInputManager:] + 146
16  TextInput                       0x394aa802 -[TIWordSearchOperationGetCandidates completeSearchOnMainThreadWithResults:] + 94
17  Foundation                      0x3431049c __NSThreadPerformPerform + 456
18  CoreFoundation                  0x339cd8f4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
19  CoreFoundation                  0x339cd158 __CFRunLoopDoSources0 + 208
20  CoreFoundation                  0x339cbf2a __CFRunLoopRun + 642
21  CoreFoundation                  0x3393f238 CFRunLoopRunSpecific + 352
22  CoreFoundation                  0x3393f0c4 CFRunLoopRunInMode + 100
23  GraphicsServices                0x3751e336 GSEventRunModal + 70
24  UIKit                           0x3585b2b4 UIApplicationMain + 1116

每次应用程序崩溃时,崩溃日志几乎相同。我已经花了几天时间,找不到任何解决方案。

有人对这个有了解吗?

--

我发现一个问题可能会导致这个问题。

我在我的项目中使用 ARC,在根视图控制器的 -[viewDidLoad] 消息中,我创建了一个子视图控制器,并在子视图控制器的 -[viewDidLoad] 消息中,创建一个 NSTimer 并添加到当前运行循环中刷新子视图控制器中的子层。

在我评论创建 NSTimer 的代码后,崩溃就消失了。

我会努力找出原因。

4

1 回答 1

0

您是否使用了 UIGraphicsBeginImageContextWithOptions ,而不是通过 UIGraphicsEndImageContext 释放上下文。或类似的东西。

于 2015-08-06T03:07:16.287 回答