Crash in IMKKit composedString(_:) using swift - swift

I am writing a swift input method (IM) using InputMethodKit. The IM basically works, I get keystrokes from inputText() and see my log messages in Konsole.
Now I implement composedString(_ sender: Any!) in swift like this:
override func composedString(_ sender: Any!) -> Any! {
let ret = NSMutableString().append("test")
return ret
}
I understand that composedString(_ sender: Any!) is called by the system when I call updateComposition(). This is indeed the case but composedString(_ sender: Any!) does crash showing that output:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libswiftCore.dylib 0x00007fff2ccbd680 swift_unknownObjectRetain + 32
1 com.IBNSoft.inputmethod.MyApp 0x000000010c08c491 #objc InputController.composedString(_:) + 33
2 com.apple.InputMethodKit 0x00007fff4670358d -[IMKInputController updateComposition] + 45
3 com.IBNSoft.inputmethod.MyApp 0x000000010c08a5bf closure #1 in InputController.inputText(_:client:) + 703 (InputController.swift:25)
4 com.IBNSoft.inputmethod.MyApp 0x000000010c086740 thunk for #escaping #callee_guaranteed () -> () + 48
5 libdispatch.dylib 0x00007fff20441603 _dispatch_call_block_and_release + 12
6 libdispatch.dylib 0x00007fff204427e6 _dispatch_client_callout + 8
7 libdispatch.dylib 0x00007fff2044eb2f _dispatch_main_queue_callback_4CF + 940
8 com.apple.CoreFoundation 0x00007fff207226f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
9 com.apple.CoreFoundation 0x00007fff206e48e2 __CFRunLoopRun + 2755
10 com.apple.CoreFoundation 0x00007fff206e375c CFRunLoopRunSpecific + 563
11 com.apple.HIToolbox 0x00007fff28905203 RunCurrentEventLoopInMode + 292
12 com.apple.HIToolbox 0x00007fff28904f65 ReceiveNextEventCommon + 587
13 com.apple.HIToolbox 0x00007fff28904d03 _BlockUntilNextEventMatchingListInModeWithFilter + 70
14 com.apple.AppKit 0x00007fff22edfb32 _DPSNextEvent + 864
15 com.apple.AppKit 0x00007fff22ede305 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1364
16 com.apple.AppKit 0x00007fff22ed0679 -[NSApplication run] + 586
17 com.apple.AppKit 0x00007fff22ea485c NSApplicationMain + 816
18 com.IBNSoft.inputmethod.MyApp 0x000000010c08935d main + 13 (AppDelegate.swift:19)
19 libdyld.dylib 0x00007fff20607f3d start + 1
The Apple docs say about composedString(_:):
Return Value:
The current composed string, which can be an NSString or
NSAttributedString object. The returned object should be an
autoreleased object.
I guess the problem is that I don't allocate the NSMutableString correctly with respect to "autorelease and retain". Can anybody shed light what the problem with that crash is an how to solve it.
Thanks

Related

iOS Crash Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000

I have received the following crash log from Firebase Crashlytics but could not identify the exact reason. It's happing on iOS devices having os version above 15.0. I am using DiffableDataSource for loading collection view and table view.
Crashed: com.apple.main-thread
0 libswiftCore.dylib 0x3da990 swift_getObjectType + 40
1 libswiftUIKit.dylib 0x9674 thunk for #escaping #callee_guaranteed (#guaranteed UITableView, #in_guaranteed IndexPath, #in_guaranteed Any) -> (#owned UITableViewCell?) + 192
2 UIKitCore 0x3e81c -[__UIDiffableDataSource collectionView:cellForItemAtIndexPath:] + 188
3 libswiftUIKit.dylib 0x2dc8 UICollectionViewDiffableDataSource.collectionView(_:cellForItemAt:) + 80
4 libswiftUIKit.dylib 0x2c0c #objc UICollectionViewDiffableDataSource.collectionView(_:cellForItemAt:) + 224
5 UIKitCore 0x32b0f4 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 1148
6 UIKitCore 0x2255f0 -[UICollectionView _updateVisibleCellsNow:] + 4372
7 UIKitCore 0x179c4c -[UICollectionView layoutSubviews] + 320
8 UIKitCore 0x18c17c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2592
9 QuartzCore 0x407fc CA::Layer::layout_if_needed(CA::Transaction*) + 532
10 QuartzCore 0x32c60 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 136
11 QuartzCore 0x475b4 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 452
12 QuartzCore 0x504a8 CA::Transaction::commit() + 704
13 UIKitCore 0x165b2c _afterCACommitHandler + 88
14 CoreFoundation 0x410c4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
15 CoreFoundation 0x10080 __CFRunLoopDoObservers + 592
16 CoreFoundation 0xb13c __CFRunLoopRun + 1052
17 CoreFoundation 0x1ebc8 CFRunLoopRunSpecific + 600
18 GraphicsServices 0x1374 GSEventRunModal + 164
19 UIKitCore 0x514b58 -[UIApplication _run] + 1100
20 UIKitCore 0x296090 UIApplicationMain + 364
21 libswiftUIKit.dylib 0x30ecc UIApplicationMain(_:_:_:_:) + 104
22 AppName 0xd640 main + 4295185984 (TagListView.swift:4295185984)
23 ??? 0x10513dda4 (Missing)
Can anyone describe what this crash is?

NSOutlineView crash on Mac OS versions below 10.12 as 'stronglyReferencesItems' set to 'false' by default

My app has an outline view which get frequent updates from server. Whenever I get an update I reload outline view. I do multiple operation with outline at the same time like showing some buttons on mouse over, expand/collapse items. For these operations I get item from outline view with NSOutlineView.item(atRow:)
The issue is, at random scenarios my app is getting crashed with EXC_BAD_ACCESS (SIGSEGV) in areas where NSOutlineView internally calls NSTableViewdelegate methods on OS versions below 10.12. I know NSOutlineView has its own retain and release cycles for the items from OS version 10.12 as stronglyReferencesItems set to true by default. so the crashes not happening above 10.12.
So how can I resolve this issue? Can some one guide me how to do manual retain and release of items passed to NSOutlineView on lower versions.
Simply put I need to enable the behaviour of stronglyReferencesItems set to true in versions below 10.12.
Note: as I said above I do complex operations with NSOutlineView like move over events, expand/collapse (expanding all the items in some scenarios), reloading the list with frequent updates from server. So mentioning my code here would be complex.
Below is one of the crash logs for your reference:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libswiftCore.dylib 0x000000010c5cec51 swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::incrementSlow(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 33
1 libswiftCore.dylib 0x000000010c5ab842 _swift_retain_n_(swift::HeapObject*, unsigned int) + 66
2 libswiftCore.dylib 0x000000010c5f7ac8 swift_bridgeObjectRetain_n + 104
3 com.prosoftnet.remotepcSuite 0x000000010bc8c626 RPCHostGroupTableCellView.setupView(group:) (in RemotePCSuite) (RPCHostGroupTableCellView.swift:0)
4 com.prosoftnet.remotepcSuite 0x000000010bd61198 RPCHostListViewController.outlineView(_:viewFor:item:) (in RemotePCSuite) (RPCHostListViewController.swift:579)
5 com.prosoftnet.remotepcSuite 0x000000010bd61a10 #objc RPCHostListViewController.outlineView(_:viewFor:item:) (in RemotePCSuite) (<compiler-generated>:0)
6 com.apple.AppKit 0x00007fff8f19e0d0 -[NSTableView(NSTableViewViewBased) makeViewForTableColumn:row:] + 76
7 com.apple.AppKit 0x00007fff8f19d541 -[NSTableRowData _addViewToRowView:atColumn:row:] + 300
8 com.apple.AppKit 0x00007fff8f19d27a -[NSTableRowData _addViewsToRowView:atRow:] + 184
9 com.apple.AppKit 0x00007fff8f19b9ad -[NSTableRowData _initializeRowView:atRow:] + 373
10 com.apple.AppKit 0x00007fff8f19aad2 -[NSTableRowData _addRowViewForVisibleRow:withPriorView:] + 396
11 com.apple.AppKit 0x00007fff8f23a9d1 -[NSTableRowData _addRowViewForVisibleRow:withPriorRowIndex:inDictionary:withRowAnimation:] + 254
12 com.apple.AppKit 0x00007fff8f23a7a3 -[NSTableRowData _unsafeUpdateVisibleRowEntries] + 1856
13 com.apple.AppKit 0x00007fff8f239fc7 -[NSTableRowData updateVisibleRowViews] + 230
14 com.apple.AppKit 0x00007fff8f23fe82 -[NSTableView viewWillDraw] + 178
15 com.apple.AppKit 0x00007fff8f2bd83f -[NSOutlineView viewWillDraw] + 169
16 com.apple.AppKit 0x00007fff8f0e6fa1 -[NSView(NSInternal) _sendViewWillDrawAndRecurse:] + 535
17 com.apple.AppKit 0x00007fff8f058ae1 -[NSView(NSLayerKitGlue) _layoutSublayersOfLayer:] + 142
18 com.apple.QuartzCore 0x00007fff8dd79404 -[CALayer layoutSublayers] + 219
19 com.apple.AppKit 0x00007fff8f058a3c _NSBackingLayerLayoutSublayers + 158
20 com.apple.QuartzCore 0x00007fff8dd78fe8 CA::Layer::layout_if_needed(CA::Transaction*) + 366
21 com.apple.QuartzCore 0x00007fff8dd78e66 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24
22 com.apple.QuartzCore 0x00007fff8dd78602 CA::Context::commit_transaction(CA::Transaction*) + 242
23 com.apple.QuartzCore 0x00007fff8dd7839e CA::Transaction::commit() + 390
24 com.apple.QuartzCore 0x00007fff8dd86f09 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 71
25 com.apple.CoreFoundation 0x00007fff99bdaf47 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
26 com.apple.CoreFoundation 0x00007fff99bdaea0 __CFRunLoopDoObservers + 368
27 com.apple.CoreFoundation 0x00007fff99bcca18 CFRunLoopRunSpecific + 328
28 com.apple.HIToolbox 0x00007fff8eb4256f RunCurrentEventLoopInMode + 235
29 com.apple.HIToolbox 0x00007fff8eb422ea ReceiveNextEventCommon + 431
30 com.apple.HIToolbox 0x00007fff8eb4212b _BlockUntilNextEventMatchingListInModeWithFilter + 71
31 com.apple.AppKit 0x00007fff8f08a8ab _DPSNextEvent + 978
32 com.apple.AppKit 0x00007fff8f089e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
33 com.apple.AppKit 0x00007fff8f07faf3 -[NSApplication run] + 594
34 com.apple.AppKit 0x00007fff8effc244 NSApplicationMain + 1832
35 com.prosoftnet.remotepcSuite 0x000000010bc519a9 main (in RemotePCSuite) (AppDelegate.swift:12)
36 libdyld.dylib 0x00007fff8e4b95c9 start + 1
You could retain the items in an array when they get first referenced from the table in the below method
var items = [ItemType]()
func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?)
{
let item = getItem()
items.append(item)
return item
}
Your gonna run into trouble with not know when you can release them though. Youll have to manually handle that logic

Cocoa archived app crashing

I am new in archiving app for testing/distribution. My MacOS cocoa app crash only when built as an archive.
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [0]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 MY.APP 0x000000010100532a specialized String._CharacterView.index(after:) + 250
1 MY.APP 0x0000000100f55ef9 specialized static TextCompletionNode.hasCommonPrefix(_:with:beyond:) + 153 (AttributeManager.swift:126)
2 MY.APP 0x0000000100f571f9 specialized TextCompletionNode.add(entry:for:) + 1161
3 MY.APP 0x0000000100f584a9 specialized closure #1 in AttributeManager.init(dataSource:loadingHandler:) + 3097
4 MY.APP 0x0000000100f5439e partial apply for closure #1 in AttributeManager.init(dataSource:loadingHandler:) + 30
5 MY.APP 0x000000010104d0a3 SearchQueryCommunicator.messageHandler(_:) + 451
6 MY.APP 0x000000010104d710 protocol witness for MessageHandler.messageHandler(_:) in conformance SearchQueryCommunicator + 16
7 MY.APP 0x000000010102ede8 Socket.handle(object:) + 456
8 MY.APP 0x0000000101031928 specialized Socket.readAvailableBytes(from:) + 1096
9 MY.APP 0x0000000101031c48 specialized Socket.stream(_:handle:) + 104 (Socket.swift:77)
10 MY.APP 0x000000010102ebff #objc Socket.stream(_:handle:) + 47
11 com.apple.CoreFoundation 0x00007fff49548dc4 _signalEventSync + 228
12 com.apple.CoreFoundation 0x00007fff49563736 _cfstream_solo_signalEventSync + 246
13 com.apple.CoreFoundation 0x00007fff49546ca4 _CFStreamSignalEvent + 484
14 com.apple.CFNetwork 0x00007fff48448a62 SocketStream::dispatchSignalFromSocketCallbackUnlocked(SocketStreamSignalHolder*) + 58
15 com.apple.CFNetwork 0x00007fff4844cff9 SocketStream::socketCallback(__CFSocket*, unsigned long, __CFData const*, void const*) + 145
16 com.apple.CFNetwork 0x00007fff4844cf2e SocketStream::_SocketCallBack_stream(__CFSocket*, unsigned long, __CFData const*, void const*, void*) + 70
17 com.apple.CoreFoundation 0x00007fff49546898 __CFSocketPerformV0 + 1016
18 com.apple.CoreFoundation 0x00007fff49527a11 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
19 com.apple.CoreFoundation 0x00007fff495e142c __CFRunLoopDoSource0 + 108
20 com.apple.CoreFoundation 0x00007fff4950a470 __CFRunLoopDoSources0 + 208
21 com.apple.CoreFoundation 0x00007fff495098ed __CFRunLoopRun + 1293
22 com.apple.CoreFoundation 0x00007fff49509153 CFRunLoopRunSpecific + 483
23 com.apple.HIToolbox 0x00007fff487f3d96 RunCurrentEventLoopInMode + 286
24 com.apple.HIToolbox 0x00007fff487f3b06 ReceiveNextEventCommon + 613
25 com.apple.HIToolbox 0x00007fff487f3884 _BlockUntilNextEventMatchingListInModeWithFilter + 64
26 com.apple.AppKit 0x00007fff46aa4a73 _DPSNextEvent + 2085
27 com.apple.AppKit 0x00007fff4723ae34 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044
28 com.apple.AppKit 0x00007fff46a99885 -[NSApplication run] + 764
29 com.apple.AppKit 0x00007fff46a68a72 NSApplicationMain + 804
30 MY.APP 0x0000000100f40949 main + 9 (AppDelegate.swift:12)
31 libdyld.dylib 0x00007fff7134a015 start + 1
Here's the TextCompletionNode function:
// we assume firstString and secondString are at least longer than beyond
private static func hasCommonPrefix(_ firstString:String, with secondString:String, beyond beyondIndex:String.Index) -> String? {
assert((firstString.endIndex >= beyondIndex) && (secondString.endIndex >= beyondIndex))
var commonPrefix = String(firstString[..<beyondIndex])
guard secondString.hasPrefix(commonPrefix) else {
return nil
}
var firstIndex = beyondIndex
let firstEndIndex = firstString.endIndex
var previousCommonPrefix: String
repeat {
previousCommonPrefix = commonPrefix
if firstIndex >= firstEndIndex {
break
}
//NSLog("firstString = \"\(firstString)\", firstIndex = \(firstIndex)")
firstIndex = firstString.index(after: firstIndex) // <-- Crashing?
commonPrefix = String(firstString[..<firstIndex])
} while secondString.hasPrefix(commonPrefix)
return previousCommonPrefix
}
Everything is working well when testing the same functionality when running the app from Xcode. I've read that debugging information is removed from archived app so you can't really debug them. I've tried to add a NSLog statement to write some debugging information in the Console app, and nothing is showing. I also tried starting the app from command-line (MyApp.app/Contents/MacOS/MyApp), nothing is showing in the terminal either.
I would like to know more about the conditions before the crash. What should I do?
EDIT: I've tried to flush STDERR and even redirect STDERR into a file based on this answer from this other post: https://stackoverflow.com/a/5938021/301189 and nothing was working. Simply replacing NSLog(_:_:) with printf(_:) helped me to get some output in the terminal. I still don't know why I can't get anything from STDERR in the archived app though.
Also, the above crash does not happen when putting output some output in the terminal. Such a weird bug...

Warning messages appear when using the NSSharingServicePicker class

2018-05-03 18:31:54.879424+0800 writer[5656:137819] warning: illegal
subclass SHKRemoteView instantiating; client should use only
NSRemoteView ( 0 ViewBridge
0x00007fff7a0cabff -[NSRemoteView _preSuperInit] + 195 1 ViewBridge
0x00007fff7a0caf83 -[NSRemoteView initWithFrame:] + 25 2 ShareKit
0x00007fff763b7aa5 -[SHKRemoteView initWithOptionsDictionary:] + 161
3 ShareKit 0x00007fff76396fbd
38-[SHKSharingService performWithItems:]_block_invoke_4 + 1347 4 libdispatch.dylib 0x00000001019eacfe
_dispatch_call_block_and_release + 12 5 libdispatch.dylib 0x00000001019e2ddf _dispatch_client_callout + 8 6 libdispatch.dylib
0x00000001019eee59 _dispatch_main_queue_callback_4CF + 549 7
CoreFoundation 0x00007fff5515bc69
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 8 CoreFoundation 0x00007fff5511de4a __CFRunLoopRun
+ 2586 9 CoreFoundation 0x00007fff5511d1a3 CFRunLoopRunSpecific + 483 10 HIToolbox
0x00007fff54405d96 RunCurrentEventLoopInMode + 286 11 HIToolbox
0x00007fff54405b06 ReceiveNextEventCommon + 613 12 HIToolbox
0x00007fff54405884 _BlockUntilNextEventMatchingListInModeWithFilter +
64 13 AppKit 0x00007fff526b8a73
_DPSNextEvent + 2085 14 AppKit 0x00007fff52e4ee34 -[NSApplication(NSEvent)
_nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044 15 AppKit 0x00007fff526ad885 -[NSApplication
run] + 764 16 AppKit 0x00007fff5267ca72
NSApplicationMain + 804 17 writer111
0x00000001002adf9d main + 13 18 libdyld.dylib
0x00007fff7d437015 start + 1 19 ???
0x0000000000000003 0x0 + 3 )
Although it works well, this warning message annoyed me, and I hope it will disappear.
A very simple method, but it has such a warning.
let sharingService = NSSharingServicePicker(items: ["111"]);
sharingService.show(relativeTo: sender.bounds, of: sender, preferredEdge: .minX);
I'm don't know the reason for the warning, but I was able to silence it by showing the picker on the new runloop:
let sharingService = NSSharingServicePicker(items: ["111"]);
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now(), execute: {
sharingService.show(relativeTo: sender.bounds, of: sender, preferredEdge: .minX)
})

Invalid pairing of layout attributes when specifying constraints programmatically in code in swift VC

I am following the pattern used in the the example here :
https://github.com/lucasderraugh/AppleProg-Cocoa-Tutorials/blob/master/Lesson%2066/Lesson%2066/AppDelegate.swift
My VC (subclass of NSViewController) looks like this :
import Cocoa
class SecondViewController: NSViewController {
var leftView = ColorView()
var rightView = ColorView()
#IBOutlet weak var nameTextField: NSTextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
}
override func viewDidAppear() {
leftView.translatesAutoresizingMaskIntoConstraints = false
rightView.translatesAutoresizingMaskIntoConstraints = false
let leftConstraints:[NSLayoutConstraint] = [
leftView.widthAnchor.constraintEqualToAnchor(self.view.topAnchor),
leftView.leftAnchor.constraintEqualToAnchor(self.view.leftAnchor),
leftView.widthAnchor.constraintEqualToConstant(100),
leftView.heightAnchor.constraintEqualToConstant(100)
]
self.view.addSubview(leftView)
NSLayoutConstraint.activateConstraints(leftConstraints)
}
override func prepareForSegue(segue: NSStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "SecondToFourthSegue" {
(segue.destinationController as! NSViewController).representedObject = nameTextField.stringValue
}
}
}
But I get the following error at runtime :
Invalid pairing of layout attributes
The full stack trace :
2016-04-26 00:54:06.402 Hyperterm[19046:1591173] An uncaught exception was raised
2016-04-26 00:54:06.403 Hyperterm[19046:1591173] *** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: Invalid pairing of layout attributes
2016-04-26 00:54:06.403 Hyperterm[19046:1591173] (
0 CoreFoundation 0x00007fff89cf94f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8b89b73c objc_exception_throw + 48
2 CoreFoundation 0x00007fff89d604bd +[NSException raise:format:] + 205
3 Foundation 0x00007fff8d717f92 VerifyConstraintArguments + 356
4 Foundation 0x00007fff8d717c16 +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:] + 295
5 Foundation 0x00007fff8d71d410 -[NSLayoutAnchor constraintEqualToAnchor:multiplier:constant:] + 149
6 Foundation 0x00007fff8d71e87f -[NSLayoutDimension constraintEqualToAnchor:multiplier:constant:] + 39
7 Hyperterm 0x000000010001bee1 _TFC9Hyperterm20SecondViewController13viewDidAppearfT_T_ + 385
8 Hyperterm 0x000000010001c4b2 _TToFC9Hyperterm20SecondViewController13viewDidAppearfT_T_ + 34
9 libdispatch.dylib 0x0000000100607070 _dispatch_call_block_and_release + 12
10 libdispatch.dylib 0x00000001005f9cc5 _dispatch_client_callout + 8
11 libdispatch.dylib 0x00000001006116ae _dispatch_main_queue_callback_4CF + 2845
12 CoreFoundation 0x00007fff89cae9e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
13 CoreFoundation 0x00007fff89c6d8dd __CFRunLoopRun + 1949
14 CoreFoundation 0x00007fff89c6ced8 CFRunLoopRunSpecific + 296
15 HIToolbox 0x00007fff949a7935 RunCurrentEventLoopInMode + 235
16 HIToolbox 0x00007fff949a776f ReceiveNextEventCommon + 432
17 HIToolbox 0x00007fff949a75af _BlockUntilNextEventMatchingListInModeWithFilter + 71
18 AppKit 0x00007fff878aeefa _DPSNextEvent + 1067
19 AppKit 0x00007fff878ae32a -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
20 AppKit 0x00007fff878a2e84 -[NSApplication run] + 682
21 AppKit 0x00007fff8786c46c NSApplicationMain + 1176
22 Hyperterm 0x000000010001b724 main + 84
23 libdyld.dylib 0x00007fff8fc285ad start + 1
24 ??? 0x0000000000000003 0x0 + 3
)
2016-04-26 00:54:06.405 Hyperterm[19046:1591173] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: Invalid pairing of layout attributes'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff89cf94f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8b89b73c objc_exception_throw + 48
2 CoreFoundation 0x00007fff89d604bd +[NSException raise:format:] + 205
3 Foundation 0x00007fff8d717f92 VerifyConstraintArguments + 356
4 Foundation 0x00007fff8d717c16 +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:] + 295
5 Foundation 0x00007fff8d71d410 -[NSLayoutAnchor constraintEqualToAnchor:multiplier:constant:] + 149
6 Foundation 0x00007fff8d71e87f -[NSLayoutDimension constraintEqualToAnchor:multiplier:constant:] + 39
7 Hyperterm 0x000000010001bee1 _TFC9Hyperterm20SecondViewController13viewDidAppearfT_T_ + 385
8 Hyperterm 0x000000010001c4b2 _TToFC9Hyperterm20SecondViewController13viewDidAppearfT_T_ + 34
9 libdispatch.dylib 0x0000000100607070 _dispatch_call_block_and_release + 12
10 libdispatch.dylib 0x00000001005f9cc5 _dispatch_client_callout + 8
11 libdispatch.dylib 0x00000001006116ae _dispatch_main_queue_callback_4CF + 2845
12 CoreFoundation 0x00007fff89cae9e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
13 CoreFoundation 0x00007fff89c6d8dd __CFRunLoopRun + 1949
14 CoreFoundation 0x00007fff89c6ced8 CFRunLoopRunSpecific + 296
15 HIToolbox 0x00007fff949a7935 RunCurrentEventLoopInMode + 235
16 HIToolbox 0x00007fff949a776f ReceiveNextEventCommon + 432
17 HIToolbox 0x00007fff949a75af _BlockUntilNextEventMatchingListInModeWithFilter + 71
18 AppKit 0x00007fff878aeefa _DPSNextEvent + 1067
19 AppKit 0x00007fff878ae32a -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
20 AppKit 0x00007fff878a2e84 -[NSApplication run] + 682
21 AppKit 0x00007fff8786c46c NSApplicationMain + 1176
22 Hyperterm 0x000000010001b724 main + 84
23 libdyld.dylib 0x00007fff8fc285ad start + 1
24 ??? 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException
leftView.widthAnchor should not equal to self.view.topAnchor You might not pay attention to it