0

我的应用程序中有一个崩溃的错误。

它发生在同一个地方,但并非总是如此。我还没有发现问题。

这是两个崩溃日志:

    Incident Identifier: EB73AE61-00FB-4282-8F1D-B8ECEC19E02D
CrashReporter Key:   6f005b28e796b18f3ab2687bb364b2be1eb137cd
Hardware Model:      iPhone5,2
Path:            /var/mobile/Applications/BF2F1016-8C00-40A3-BB75-0933F53741F0/*******.app/******
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                    0x312d13e2 __exceptionPreprocess + 158
1   libobjc.A.dylib                   0x38fc295e objc_exception_throw + 26
2   CoreFoundation                    0x312d1302 +[NSException raise:format:] + 102
3   QuartzCore                        0x32e8e106 CA::Layer::set_position(CA::Vec2<double> const&, bool) + 206
4   QuartzCore                        0x32e8e02e -[CALayer setPosition:] + 46
5   QuartzCore                        0x32e8dfc2 -[CALayer setFrame:] + 554
6   UIKit                             0x330e1bd2 -[UIView(Geometry) setFrame:] + 230
7   UIKit                             0x330e18fc -[UIImageView _setViewGeometry:forMetric:] + 180
8   UIKit                             0x330e183a -[UIImageView setFrame:] + 42
9   etapes                            0x0006de1c 0x5c000 + 73244
10  UIKit                             0x33203136 -[UIScrollView _endPanWithEvent:] + 3694
11  UIKit                             0x3321c520 -[UIScrollView handlePan:] + 120
12  UIKit                             0x331fdc5c _UIGestureRecognizerSendActions + 124
13  UIKit                             0x331c539c -[UIGestureRecognizer _updateGestureWithEvent:] + 388
14  UIKit                             0x333b215e ___UIGestureRecognizerUpdate_block_invoke_0543 + 42
15  UIKit                             0x330e987e _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 214
16  UIKit                             0x330e82c8 _UIGestureRecognizerUpdate + 1160
17  UIKit                             0x330f31e2 -[UIWindow _sendGesturesForEvent:] + 762
18  UIKit                             0x330f2dae -[UIWindow sendEvent:] + 86
19  UIKit                             0x330e08dc -[UIApplication sendEvent:] + 376
20  UIKit                             0x330e01ea _UIApplicationHandleEvent + 6194
21  GraphicsServices                  0x34df75f2 _PurpleEventCallback + 586
22  GraphicsServices                  0x34df7222 PurpleEventCallback + 30
23  CoreFoundation                    0x312a63e2 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 30
24  CoreFoundation                    0x312a6386 __CFRunLoopDoSource1 + 134
25  CoreFoundation                    0x312a520a __CFRunLoopRun + 1378
26  CoreFoundation                    0x31218238 CFRunLoopRunSpecific + 352
27  CoreFoundation                    0x312180c4 CFRunLoopRunInMode + 100
28  GraphicsServices                  0x34df6336 GSEventRunModal + 70
29  UIKit                             0x331342b4 UIApplicationMain + 1116
30  etapes                            0x0005e15e 0x5c000 + 8542
31  etapes                            0x0005e114 0x5c000 + 8468

/////////////////////////////////////////////////////////////////////////////////// ///////////////

Incident Identifier: 4FE03135-D442-4CEA-B230-8322647262EE
CrashReporter Key:   6f005b28e796b18f3ab2687bb364b2be1eb137cd
Hardware Model:      iPhone5,2
Process:         etapes [2916]
Path:            /var/mobile/Applications/BF2F1016-8C00-40A3-BB75-0933F53741F0/******.app/****
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000064
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   UIKit                             0x33df7b06 -[UIView(CALayerDelegate) actionForLayer:forKey:] + 138
1   QuartzCore                        0x33ba7786 -[CALayer actionForKey:] + 70
2   QuartzCore                        0x33ba7732 _ZL12actionForKeyP7CALayerPN2CA11TransactionEP8NSString + 54
3   QuartzCore                        0x33ba7626 CA::Layer::begin_change(CA::Transaction*, unsigned int, objc_object*&) + 126
4   QuartzCore                        0x33ba2322 CA::Layer::setter(unsigned int, _CAValueType, void const*) + 178
5   QuartzCore                        0x33bce782 -[CALayer setBackgroundColor:] + 30
6   UIKit                             0x33e0ef50 -[UIView(Internal) _setBackgroundCGColor:withSystemColorName:] + 1016
7   etapes                            0x000fc8d2 0xdd000 + 129234
8   etapes                            0x000f8c6a 0xdd000 + 113770
9   CoreFoundation                    0x31fe9ad0 __invoking___ + 64
10  CoreFoundation                    0x31f4128a -[NSInvocation invoke] + 286
11  Foundation                        0x328eaf60 -[NSInvocationOperation main] + 108
12  Foundation                        0x32874a84 -[__NSOperationInternal start] + 836
13  Foundation                        0x328ecfe2 __block_global_6 + 98
14  libdispatch.dylib                 0x3a0f1790 _dispatch_call_block_and_release + 8
15  libdispatch.dylib                 0x3a0f15d8 _dispatch_client_callout + 20
16  libdispatch.dylib                 0x3a0f4e40 _dispatch_main_queue_callback_4CF + 224
17  CoreFoundation                    0x31fba1ac __CFRunLoopRun + 1284
18  CoreFoundation                    0x31f2d238 CFRunLoopRunSpecific + 352
19  CoreFoundation                    0x31f2d0c4 CFRunLoopRunInMode + 100
20  GraphicsServices                  0x35b0b336 GSEventRunModal + 70
21  UIKit                             0x33e492b4 UIApplicationMain + 1116
22  etapes                            0x000df15e 0xdd000 + 8542
23  etapes                            0x000df114 0xdd000 + 8468

如果您想了解更多详细信息,我可以!

经过研究,这是问题所在的代码:

self.imageviewFondArticle.frame = CGRectMake((-((_imageviewFondArticle.frame.size.height*imageRatio)-320)/2),0, _imageviewFondArticle.frame.size.height*imageRatio, _imageviewFondArticle.frame.size.height);
4

1 回答 1

1

首先,根据Apple 的文档,CALayer 的“框架”是“计算属性” 。您可能想要设置边界、锚点或位置属性。(相比之下,UIView 的框架可以设置和动画。)

其次,我来这个帖子是因为我也遇到了这样的崩溃。它发生在我设置 CALayer 的位置属性时。事实证明,抛出的异常是针对无效位置的 - 其中一个坐标是 NaN。我通过将“layer.position = pos”包装在@try-@catch 块中找到了这一点。修复无效位置的根本原因为我解决了这个问题。基于此,我猜您的“imageRatio”值无效。

于 2013-02-17T05:55:41.520 回答