我们正在开发的应用程序已收到崩溃,堆栈跟踪如下。在调试时,我们有一段时间无法找到问题的根源。我知道问题与释放的对象有关。如果有人可以指出我的类(class)方向或观点或导致问题的原因,我将不胜感激。谢谢
Incident Identifier:
CrashReporter Key:
Hardware Model: iPhone9,4
Process: MYAPP [26490]
Path: /var/containers/Bundle/Application/2D7244DE-6519-43CB-B3FF-AD502F5921D7/MYAPP.app/MYAPP
Identifier: com.MYAPP.ios
Version: 1.2.0 (120)
Code Type: ARM-64
Parent Process: ??? [1]
Date/Time: 2017-08-24T13:57:21Z
Launch Time: 2017-08-24T13:32:26Z
OS Version: iPhone OS 10.2.1 (14D27)
Report Version: 104
Exception Type: SIGABRT
Exception Codes: #0 at 0x18c747014
Crashed Thread: 0
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018c747014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000018c80f450 pthread_kill + 108
2 libsystem_c.dylib 0x000000018c6bb400 abort + 136
3 libsystem_malloc.dylib 0x000000018c78ba5c nanozone_error + 328
4 libsystem_malloc.dylib 0x000000018c78cf18 nano_realloc + 372
5 libsystem_malloc.dylib 0x000000018c77f240 malloc_zone_realloc + 176
6 Foundation 0x000000018e1ca628 -[NSString quotedStringRepresentation] + 728
7 Foundation 0x000000018e1aa44c -[NSString _stringRepresentation] + 372
8 CoreFoundation 0x000000018d6a1f3c -[NSArray descriptionWithLocale:indent:] + 400
9 Foundation 0x000000018e184af4 _NSDescriptionWithLocaleFunc + 72
10 CoreFoundation 0x000000018d73a23c __CFStringAppendFormatCore + 7992
11 CoreFoundation 0x000000018d7382c8 _CFStringCreateWithFormatAndArgumentsAux2 + 240
12 Foundation 0x000000018e184968 +[NSString stringWithFormat:] + 64
13 UIKit 0x0000000193f83090 UIViewAlertForUnsatisfiableConstraints + 660
14 Foundation 0x000000018e1f94cc -[NSISEngine handleUnsatisfiableRowWithHead:body:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 460
15 Foundation 0x000000018e1d9df8 -[NSISEngine tryUsingArtificialVariableToAddConstraintWithMarker:rowBody:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 380
16 Foundation 0x000000018e1d59c4 -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] + 684
17 Foundation 0x000000018e1d55cc -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 280
18 Foundation 0x000000018e1d31e0 -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 268
19 UIKit 0x000000019372b2a0 -[UIView(UIConstraintBasedLayout) _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 504
20 UIKit 0x000000019372b068 -[UIView(UIConstraintBasedLayout) _tryToAddConstraintWithoutUpdatingConstraintsArray:roundingAdjustment:mutuallyExclusiveConstraints:] + 32
21 UIKit 0x000000019372b028 -[UIView(UIConstraintBasedLayout) _tryToAddConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 224
22 UIKit 0x0000000193f77900 -[UIView(UIConstraintBasedLayout) _resetLayoutEngineHostConstraintsForAxis:] + 324
23 Foundation 0x000000018e1d2d10 -[NSISEngine withBehaviors:performModifications:] + 164
24 UIKit 0x0000000193f7799c -[UIView(UIConstraintBasedLayout) _resetLayoutEngineHostConstraints] + 68
25 UIKit 0x000000019376c1f0 -[UIView(UIConstraintBasedLayout) _updateLayoutEngineHostConstraints] + 548
26 UIKit 0x0000000193f7f1cc -[UIView(AdditionalLayoutSupport) _updateSystemConstraints] + 68
27 UIKit 0x0000000193f7de80 -[UIView(AdditionalLayoutSupport) _sendUpdateConstraintsIfNecessaryForSecondPass:] + 188
28 UIKit 0x0000000193f7e1d0 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 628
29 Foundation 0x000000018e1d2d10 -[NSISEngine withBehaviors:performModifications:] + 164
30 UIKit 0x0000000193f7e41c -[UIView(AdditionalLayoutSupport) _recursiveUpdateConstraintsIfNeededCollectingViews:forSecondPass:] + 116
31 UIKit 0x0000000193f7e158 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 508
32 UIKit 0x0000000193f7e974 __100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke + 80
33 UIKit 0x0000000193f7db30 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 132
34 UIKit 0x0000000193f7e580 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 160
35 UIKit 0x0000000193f7f58c -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 368
36 UIKit 0x00000001939285e4 -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 176
37 UIKit 0x000000019362bacc -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1268
38 QuartzCore 0x0000000190ad99d8 -[CALayer layoutSublayers] + 144
39 QuartzCore 0x0000000190ace4cc CA::Layer::layout_if_needed(CA::Transaction*) + 288
40 UIKit 0x0000000193640500 -[UIView(Hierarchy) layoutBelowIfNeeded] + 1012
41 UIKit 0x000000019363c7dc +[UIView(Animation) performWithoutAnimation:] + 100
42 UIKit 0x0000000193971cbc -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 1068
43 UIKit 0x0000000193971d88 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 76
44 UIKit 0x000000019395f320 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2300
45 UIKit 0x0000000193976dec -[UITableView _performWithCachedTraitCollection:] + 112
46 UIKit 0x0000000193712de8 -[UITableView layoutSubviews] + 172
47 UIKit 0x000000019362ba80 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1192
48 QuartzCore 0x0000000190ad99d8 -[CALayer layoutSublayers] + 144
49 QuartzCore 0x0000000190ace4cc CA::Layer::layout_if_needed(CA::Transaction*) + 288
50 QuartzCore 0x0000000190ace38c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 28
51 QuartzCore 0x0000000190a4b3e0 CA::Context::commit_transaction(CA::Transaction*) + 248
52 QuartzCore 0x0000000190a72a68 CA::Transaction::commit() + 508
53 QuartzCore 0x0000000190a73488 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 116
54 CoreFoundation 0x000000018d7260c0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
55 CoreFoundation 0x000000018d723cf0 __CFRunLoopDoObservers + 368
56 CoreFoundation 0x000000018d724180 __CFRunLoopRun + 1020
57 CoreFoundation 0x000000018d6522b8 CFRunLoopRunSpecific + 440
58 GraphicsServices 0x000000018f106198 GSEventRunModal + 176
59 UIKit 0x00000001936997fc -[UIApplication _run] + 680
60 UIKit 0x0000000193694534 UIApplicationMain + 204
61 MYAPP 0x000000010003ad3c main (AppDelegate.swift:26)
62 ??? 0x000000018c6355b8 0x0 + 0
Thread 1:
0 libsystem_kernel.dylib 0x000000018c729188 mach_msg_trap + 8
1 CoreFoundation 0x000000018d7265d0 __CFRunLoopServiceMachPort + 188
2 CoreFoundation 0x000000018d7241ec __CFRunLoopRun + 1128
3 CoreFoundation 0x000000018d6522b8 CFRunLoopRunSpecific + 440
4 Foundation 0x000000018e18f26c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300
5 Foundation 0x000000018e1afdd0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 92
6 UIKit 0x000000019400dc38 -[UIEventFetcher threadMain] + 132
7 Foundation 0x000000018e28ce68 __NSThread__start__ + 1020
8 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
9 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
10 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 2:
0 libsystem_kernel.dylib 0x000000018c729188 mach_msg_trap + 8
1 CoreFoundation 0x000000018d7265d0 __CFRunLoopServiceMachPort + 188
2 CoreFoundation 0x000000018d7241ec __CFRunLoopRun + 1128
3 CoreFoundation 0x000000018d6522b8 CFRunLoopRunSpecific + 440
4 CFNetwork 0x000000018de57a70 +[NSURLConnection(Loader) _resourceLoadLoop:] + 332
5 Foundation 0x000000018e28ce68 __NSThread__start__ + 1020
6 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
7 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
8 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 3:
0 libsystem_kernel.dylib 0x000000018c729188 mach_msg_trap + 8
1 CoreFoundation 0x000000018d7265d0 __CFRunLoopServiceMachPort + 188
2 CoreFoundation 0x000000018d7241ec __CFRunLoopRun + 1128
3 CoreFoundation 0x000000018d6522b8 CFRunLoopRunSpecific + 440
4 CoreFoundation 0x000000018d7340ec _legacyStreamRunLoop_workThread + 264
5 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
6 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
7 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 4:
0 libsystem_kernel.dylib 0x000000018c74723c __select + 8
1 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
2 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
3 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 5:
0 libsystem_kernel.dylib 0x000000018c729188 mach_msg_trap + 8
1 CoreFoundation 0x000000018d7265d0 __CFRunLoopServiceMachPort + 188
2 CoreFoundation 0x000000018d7241ec __CFRunLoopRun + 1128
3 CoreFoundation 0x000000018d6522b8 CFRunLoopRunSpecific + 440
4 AVFAudio 0x00000001a7157d24 GenericRunLoopThread::Entry(void*) + 160
5 AVFAudio 0x00000001a717dd9c CAPThread::Entry(CAPThread*) + 80
6 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
7 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
8 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 6:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x00000001021480ac 0x102110000 + 229548
2 TwilioChatClient 0x0000000102151c2c 0x102110000 + 269356
3 TwilioChatClient 0x0000000102162c8c 0x102110000 + 339084
4 TwilioChatClient 0x000000010215f7fc 0x102110000 + 325628
5 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
6 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
7 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 7:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 8:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 9:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 10:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 11:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 12:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 13:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 14:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 15:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 16:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 17:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 18:
0 libsystem_kernel.dylib 0x000000018c72d64c kevent + 8
1 TwilioChatClient 0x000000010224f88c 0x102110000 + 1308812
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 19:
0 libsystem_kernel.dylib 0x000000018c746e1c __psynch_cvwait + 8
1 TwilioChatClient 0x000000010224f834 0x102110000 + 1308724
2 TwilioChatClient 0x000000010224f614 0x102110000 + 1308180
3 TwilioChatClient 0x000000010224f2f8 0x102110000 + 1307384
4 libsystem_pthread.dylib 0x000000018c80d850 _pthread_body + 236
5 libsystem_pthread.dylib 0x000000018c80d760 _pthread_start + 280
6 libsystem_pthread.dylib 0x000000018c80ad94 thread_start + 0
Thread 0 crashed with ARM-64 Thread State:
pc: 0x000000018c747014 fp: 0x000000016fdcd430 sp: 0x000000016fdcd410 x0: 0x0000000000000000
x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000 x4: 0x0000000000000000
x5: 0x0000000000000000 x6: 0x0000000000000001 x7: 0x0000000000000000 x8: 0x0000000008000000
x9: 0x0000000004000000 x10: 0x0000000000000000 x11: 0x000000000000000a x12: 0x0000000000000000
x13: 0x0000000000000035 x14: 0x0034003100780030 x15: 0x0037003700300033 x16: 0x0000000000000148
x17: 0x000000018d65ca34 x18: 0x0000000000000000 x19: 0x0000000000000006 x20: 0x00000001b2f01c40
x21: 0x0000000000000001 x22: 0x0000000103164000 x23: 0x0000000177f1c1c0 x24: 0x0000000000000000
x25: 0xbaddc0dedeadbead x26: 0x000000000000ffff x27: 0x0000000000000087 x28: 0x000000000000005c
lr: 0x000000018c80f450 cpsr: 0x0000000000000000
Link Register Analysis:
Symbol: pthread_kill + 108
Description: We have determined that the link register (lr) is very likely to contain the return address of frame #0's calling function, and have inserted it into the crashing thread's backtrace as frame #1 to aid in analysis. This determination was made by applying a heuristic to determine whether the crashing function was likely to have created a new stack frame at the time of the crash.
Type: 1
如果需要,我可以上传其余的堆栈跟踪。帖子正文长度有限制。
最佳答案
我无法给你一个准确的诊断,但也许这些观察可以帮助缩小可能性范围。
1) 崩溃不在您的代码中(至少不直接),因为堆栈跟踪仅包含系统/UIKit 调用。
2) 准备字符串时出现错误,看似是报告布局约束问题的错误(警报)消息。
3) 尝试显示警报之前的调用表明布局约束正在尝试将坐标四舍五入调整为整数值。
4) 正在处理的布局正在准备 UITableView 单元格。但它可能不在对您的代码的调用中(即不在出列自定义 UITableViewCell 中)。所以这将是表格 View 中的静态或标准单元格。
5) 布局处理的模式似乎表明涉及“比例”约束,并且大小和比率产生的值超过整数的大小。准备错误消息时出现错误这一事实使我相信这可能与无效数值有关。请注意,字符串失败可能有其他原因,但调用的上下文与大数字一致。
6) 布局过程由不调用您的代码(或至少似乎不调用)的值观察器触发。问题的触发因素(用户操作)可能是一个 UI 更改事件,应该/应该自动处理(例如设备方向更改)。由于这发生在 iPhone 上,您可以排除分屏问题(您只能在 iPad 上遇到)。其他可能的事件将取决于您的应用程序做什么。
有了这个,您可能可以将可能性缩小到具有带静态单元格的 UITableview 的 View 。这些单元格必须包含一些使用比例约束的 subview (例如纵横比、相对高度/宽度)。请注意,布局约束函数的名称表明这可能是在 tableView 单元格和 tableview 之间自动设置的相关内部约束。如果是这种情况,在某些时候至少会涉及到您自己的约束之一。
如果您的应用程序没有大量的 TableView ,您可以将调查重点放在对用户操作的“自动” react 上,这些操作可以在您拥有的 UITableview 上执行。鉴于这种情况发生在 iPhone 上,您还需要检查通过 unwind segues 或 dismiss() 从模态视图返回的转换。 iPhone 和 iPod 经常从呈现的 VC 中释放一些 UI 元素,这在某些情况下可能会导致不需要的行为。
希望这对您有所帮助。
关于ios - 线程 0 崩溃,SIGABRT 异常和 __pthread_kill,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45869985/
为了将Cucumber用于命令行脚本,我按照提供的说明安装了arubagem。它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了require'aruba/cucumber'在'features/env.rb'中为了确保它能正常工作,我写了以下场景:@announceScenario:Testingcucumber/arubaGivenablankslateThentheoutputfrom"ls-la"shouldcontain"drw"假设事情应该失败。它确实失败了,但失败的原因是错误的:@announceScenario:Testingcucumber/ar
当我在Rails控制台中按向上或向左箭头时,出现此错误:irb(main):001:0>/Users/me/.rvm/gems/ruby-2.0.0-p247/gems/rb-readline-0.4.2/lib/rbreadline.rb:4269:in`blockin_rl_dispatch_subseq':invalidbytesequenceinUTF-8(ArgumentError)我使用rvm来管理我的ruby安装。我正在使用=>ruby-2.0.0-p247[x86_64]我使用bundle来管理我的gem,并且我有rb-readline(0.4.2)(人们推荐的最少
我收到这个错误:RuntimeError(自动加载常量Apps时检测到循环依赖当我使用多线程时。下面是我的代码。为什么会这样?我尝试多线程的原因是因为我正在编写一个HTML抓取应用程序。对Nokogiri::HTML(open())的调用是一个同步阻塞调用,需要1秒才能返回,我有100,000多个页面要访问,所以我试图运行多个线程来解决这个问题。有更好的方法吗?classToolsController0)app.website=array.join(',')putsapp.websiteelseapp.website="NONE"endapp.saveapps=Apps.order("
我正在学习Rails,并阅读了关于乐观锁的内容。我已将类型为integer的lock_version列添加到我的articles表中。但现在每当我第一次尝试更新记录时,我都会收到StaleObjectError异常。这是我的迁移:classAddLockVersionToArticle当我尝试通过Rails控制台更新文章时:article=Article.first=>#我这样做:article.title="newtitle"article.save我明白了:(0.3ms)begintransaction(0.3ms)UPDATE"articles"SET"title"='dwdwd
在Cooper的书BeginningRuby中,第166页有一个我无法重现的示例。classSongincludeComparableattr_accessor:lengthdef(other)@lengthother.lengthenddefinitialize(song_name,length)@song_name=song_name@length=lengthendenda=Song.new('Rockaroundtheclock',143)b=Song.new('BohemianRhapsody',544)c=Song.new('MinuteWaltz',60)a.betwee
这里有一个很好的答案解释了如何在Ruby中下载文件而不将其加载到内存中:https://stackoverflow.com/a/29743394/4852737require'open-uri'download=open('http://example.com/image.png')IO.copy_stream(download,'~/image.png')我如何验证下载文件的IO.copy_stream调用是否真的成功——这意味着下载的文件与我打算下载的文件完全相同,而不是下载一半的损坏文件?documentation说IO.copy_stream返回它复制的字节数,但是当我还没有下
我正在尝试解析一个文本文件,该文件每行包含可变数量的单词和数字,如下所示:foo4.500bar3.001.33foobar如何读取由空格而不是换行符分隔的文件?有什么方法可以设置File("file.txt").foreach方法以使用空格而不是换行符作为分隔符? 最佳答案 接受的答案将slurp文件,这可能是大文本文件的问题。更好的解决方案是IO.foreach.它是惯用的,将按字符流式传输文件:File.foreach(filename,""){|string|putsstring}包含“thisisanexample”结果的
我早就知道Ruby中的“常量”(即大写的变量名)不是真正常量。与其他编程语言一样,对对象的引用是唯一存储在变量/常量中的东西。(侧边栏:Ruby确实具有“卡住”引用对象不被修改的功能,据我所知,许多其他语言都没有提供这种功能。)所以这是我的问题:当您将一个值重新分配给常量时,您会收到如下警告:>>FOO='bar'=>"bar">>FOO='baz'(irb):2:warning:alreadyinitializedconstantFOO=>"baz"有没有办法强制Ruby抛出异常而不是打印警告?很难弄清楚为什么有时会发生重新分配。 最佳答案
1.错误信息:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:requestcanceledwhilewaitingforconnection(Client.Timeoutexceededwhileawaitingheaders)或者:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:TLShandshaketimeout2.报错原因:docker使用的镜像网址默认为国外,下载容易超时,需要修改成国内镜像地址(首先阿里
SPI接收数据左移一位问题目录SPI接收数据左移一位问题一、问题描述二、问题分析三、探究原理四、经验总结最近在工作在学习调试SPI的过程中遇到一个问题——接收数据整体向左移了一位(1bit)。SPI数据收发是数据交换,因此接收数据时从第二个字节开始才是有效数据,也就是数据整体向右移一个字节(1byte)。请教前辈之后也没有得到解决,通过在网上查阅前人经验终于解决问题,所以写一个避坑经验总结。实际背景:MCU与一款芯片使用spi通信,MCU作为主机,芯片作为从机。这款芯片采用的是它规定的六线SPI,多了两根线:RDY和INT,这样从机就可以主动请求主机给主机发送数据了。一、问题描述根据从机芯片手