I have built a document based app in swift and then I added a NSCollectionView to it with an add button next to it. The button would call a NSOpenPanel and then the icon of the item chosen should appear in the collection view. However, when I click the 'open' button in the NSOpenPanel, the following were printed to the console:
2017-01-30 19:36:54.205343 CookRecipes[5004:203650] -[NSScrollView reloadData]: unrecognized selector sent to instance 0x6180001c1770
2017-01-30 19:36:54.224746 CookRecipes[5004:203650] -[NSVBSavePanel didEndPanelWithReturnCode:] caught non-fatal NSInvalidArgumentException '-[NSScrollView reloadData]: unrecognized selector sent to instance 0x6180001c1770' with backtrace (
0 CoreFoundation 0x00007fff9e2010db __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fffb2e92a2a objc_exception_throw + 48
2 CoreFoundation 0x00007fff9e281cd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff9e1742a3 ___forwarding___ + 1059
4 CoreFoundation 0x00007fff9e173df8 _CF_forwarding_prep_0 + 120
5 CookRecipes 0x0000000100004239 _TFFC11CookRecipes8Document7addFileFT_T_U_FSiT_ + 457
6 CookRecipes 0x00000001000047ef _TTRXFo_dSi__XFdCb_dSi__ + 47
7 AppKit 0x00007fff9c0665e4 -[NSVBSavePanel didEndPanelWithReturnCode:] + 68
8 AppKit 0x00007fff9c6ba09d -[NSVBSavePanel completeModeless:] + 74
9 AppKit 0x00007fff9befa721 -[NSVBSavePanel observeValueForKeyPath:ofObject:change:context:] + 597
10 Foundation 0x00007fff9fbcb71d NSKeyValueNotifyObserver + 350
11 Foundation 0x00007fff9fbcafb4 NSKeyValueDidChange + 486
12 Foundation 0x00007fff9fb99e96 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 118
13 ViewBridge 0x00007fffb184c066 __41-[NSViewBridge setObject:forKey:withKVO:]_block_invoke + 447
14 ViewBridge 0x00007fffb18d052b withHintInProgress + 487
15 ViewBridge 0x00007fffb184be83 -[NSViewBridge setObject:forKey:withKVO:] + 1014
16 ViewBridge 0x00007fffb184a95a -[NSViewBridge nonLocalChangeInProgress:block:] + 390
17 ViewBridge 0x00007fffb18aa260 -[NSRemoteViewMarshal exceptionSafeSetRemoteObject:forKey:withReply:] + 256
18 ViewBridge 0x00007fffb18aa3e8 -[NSRemoteViewMarshal setRemoteObject:forKey:withReply:] + 56
19 CoreFoundation 0x00007fff9e1756dc __invoking___ + 140
20 CoreFoundation 0x00007fff9e175561 -[NSInvocation invoke] + 289
21 ViewBridge 0x00007fffb18d052b withHintInProgress + 487
22 ViewBridge 0x00007fffb18d025a __deferNSXPCInvocationOntoMainThread_block_invoke_2 + 233
23 ViewBridge 0x00007fffb1851df2 +[NSViewServiceApplication withHostPID:invoke:] + 46
24 ViewBridge 0x00007fffb18d011d __deferNSXPCInvocationOntoMainThread_block_invoke + 179
25 ViewBridge 0x00007fffb18cfd0a __deferBlockOntoMainThread_block_invoke_2 + 544
26 CoreFoundation 0x00007fff9e19771c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
27 CoreFoundation 0x00007fff9e1789d4 __CFRunLoopDoBlocks + 356
28 CoreFoundation 0x00007fff9e178516 __CFRunLoopRun + 1894
29 CoreFoundation 0x00007fff9e177b54 CFRunLoopRunSpecific + 420
30 HIToolbox 0x00007fff9d702a5c RunCurrentEventLoopInMode + 240
31 HIToolbox 0x00007fff9d702891 ReceiveNextEventCommon + 432
32 HIToolbox 0x00007fff9d7026c6 _BlockUntilNextEventMatchingListInModeWithFilter + 71
33 AppKit 0x00007fff9bca85b4 _DPSNextEvent + 1120
34 AppKit 0x00007fff9c422d6b -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2789
35 AppKit 0x00007fff9bc9cf35 -[NSApplication run] + 926
36 AppKit 0x00007fff9bc67850 NSApplicationMain + 1237
37 CookRecipes 0x000000010000c344 main + 84
38 libdyld.dylib 0x00007fffb3774255 start + 1
39 ??? 0x0000000000000003 0x0 + 3
)
2017-01-30 19:36:54.239473 CookRecipes[5004:203650] -[NSVBSavePanel observeValueForKeyPath:ofObject:change:context:] caught non-fatal NSInvalidArgumentException '-[NSScrollView reloadData]: unrecognized selector sent to instance 0x6180001c1770' with backtrace (
0 CoreFoundation 0x00007fff9e2010db __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fffb2e92a2a objc_exception_throw + 48
2 CoreFoundation 0x00007fff9e281cd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff9e1742a3 ___forwarding___ + 1059
4 CoreFoundation 0x00007fff9e173df8 _CF_forwarding_prep_0 + 120
5 CookRecipes 0x0000000100004239 _TFFC11CookRecipes8Document7addFileFT_T_U_FSiT_ + 457
6 CookRecipes 0x00000001000047ef _TTRXFo_dSi__XFdCb_dSi__ + 47
7 AppKit 0x00007fff9c0665e4 -[NSVBSavePanel didEndPanelWithReturnCode:] + 68
8 AppKit 0x00007fff9c6ba09d -[NSVBSavePanel completeModeless:] + 74
9 AppKit 0x00007fff9befa721 -[NSVBSavePanel observeValueForKeyPath:ofObject:change:context:] + 597
10 Foundation 0x00007fff9fbcb71d NSKeyValueNotifyObserver + 350
11 Foundation 0x00007fff9fbcafb4 NSKeyValueDidChange + 486
12 Foundation 0x00007fff9fb99e96 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 118
13 ViewBridge 0x00007fffb184c066 __41-[NSViewBridge setObject:forKey:withKVO:]_block_invoke + 447
14 ViewBridge 0x00007fffb18d052b withHintInProgress + 487
15 ViewBridge 0x00007fffb184be83 -[NSViewBridge setObject:forKey:withKVO:] + 1014
16 ViewBridge 0x00007fffb184a95a -[NSViewBridge nonLocalChangeInProgress:block:] + 390
17 ViewBridge 0x00007fffb18aa260 -[NSRemoteViewMarshal exceptionSafeSetRemoteObject:forKey:withReply:] + 256
18 ViewBridge 0x00007fffb18aa3e8 -[NSRemoteViewMarshal setRemoteObject:forKey:withReply:] + 56
19 CoreFoundation 0x00007fff9e1756dc __invoking___ + 140
20 CoreFoundation 0x00007fff9e175561 -[NSInvocation invoke] + 289
21 ViewBridge 0x00007fffb18d052b withHintInProgress + 487
22 ViewBridge 0x00007fffb18d025a __deferNSXPCInvocationOntoMainThread_block_invoke_2 + 233
23 ViewBridge 0x00007fffb1851df2 +[NSViewServiceApplication withHostPID:invoke:] + 46
24 ViewBridge 0x00007fffb18d011d __deferNSXPCInvocationOntoMainThread_block_invoke + 179
25 ViewBridge 0x00007fffb18cfd0a __deferBlockOntoMainThread_block_invoke_2 + 544
26 CoreFoundation 0x00007fff9e19771c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
27 CoreFoundation 0x00007fff9e1789d4 __CFRunLoopDoBlocks + 356
28 CoreFoundation 0x00007fff9e178516 __CFRunLoopRun + 1894
29 CoreFoundation 0x00007fff9e177b54 CFRunLoopRunSpecific + 420
30 HIToolbox 0x00007fff9d702a5c RunCurrentEventLoopInMode + 240
31 HIToolbox 0x00007fff9d702891 ReceiveNextEventCommon + 432
32 HIToolbox 0x00007fff9d7026c6 _BlockUntilNextEventMatchingListInModeWithFilter + 71
33 AppKit 0x00007fff9bca85b4 _DPSNextEvent + 1120
34 AppKit 0x00007fff9c422d6b -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2789
35 AppKit 0x00007fff9bc9cf35 -[NSApplication run] + 926
36 AppKit 0x00007fff9bc67850 NSApplicationMain + 1237
37 CookRecipes 0x000000010000c344 main + 84
38 libdyld.dylib 0x00007fffb3774255 start + 1
39 ??? 0x0000000000000003 0x0 + 3
)
I think that the code that the problem is in should be in this segment:
extension Document : AddAttachmentDelegate {
internal func addFile() {
let panel = NSOpenPanel()
panel.allowsMultipleSelection = false
panel.canChooseDirectories = false
panel.canChooseFiles = true
panel.begin { (result) -> Void in
if result == NSModalResponseOK, let resultURL = panel.urls.first {
do {
try self.addAttachmentAtURL(url: resultURL)
self.attachmentsList?.reloadData()
} catch let error as NSError {
if let window = self.windowForSheet {
NSApp.presentError(error, modalFor: window, delegate: nil, didPresent: nil, contextInfo: nil)
} else {
NSApp.presentError(error)
}
}
}
}
}
}
I have no idea what is going on. Hope you can help.
EDIT: attachmentsList is connected by the following:
#IBOutlet weak var attachmentsList: NSCollectionView!
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have a macCatalyst app that works perfectly on macOS 10.14, however on upgrading to macOS 11 (Big Sur) both I and my users are complaining that the app crashes on launch. I get an error message "Parameter was not of class UIScene" - do macCatalyst apps now require the use of scenes?
On further inspection, I see the following:
2020-11-28 01:48:40.327810+0000 AppName [13691:435322] *** Assertion failure in -[_UISceneMacHelperUtilities sceneIdentifierForUIScene:], _UISceneMacHelperUtilities.m:83
2020-11-28 01:48:40.336334+0000 AppName[13691:435322] [General] An uncaught exception was raised
2020-11-28 01:48:40.336423+0000 AppName[13691:435322] [General] Parameter was not of class UIScene.
2020-11-28 01:48:40.336545+0000 AppName[13691:435322] [General] (
0 CoreFoundation 0x00007fff204ae6af __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201e63c9 objc_exception_throw + 48
2 CoreFoundation 0x00007fff204d7512 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff212906c9 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 UIKitCore 0x00007fff44a7b2c6 -[_UISceneMacHelperUtilities sceneIdentifierForUIScene:] + 195
5 UIKitMacHelper 0x00007fff34045f74 __46-[UINSApplicationDelegate _setupKeyWindowSync]_block_invoke + 393
6 Foundation 0x00007fff21192d6b -[__NSObserver _doit:] + 287
7 CoreFoundation 0x00007fff20429fdc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
8 CoreFoundation 0x00007fff204c589b ___CFXRegistrationPost_block_invoke + 49
9 CoreFoundation 0x00007fff204c580f _CFXRegistrationPost + 454
10 CoreFoundation 0x00007fff203fabce _CFXNotificationPost + 723
11 Foundation 0x00007fff21166abe -[NSNotificationCenter postNotificationName:object:userInfo:] + 59
12 UIKitCore 0x00007fff44376779 -[UIWindow _makeKeyWindowIgnoringOldKeyWindow:] + 567
13 AppName 0x00000001013fe0c0 $s25AppName13SceneDelegateC5scene_13willConnectTo7optionsySo7UISceneC_So0K7SessionCSo0K17ConnectionOptionsCtF + 1520
14 AppName 0x00000001013feaa6 $s25AppName13SceneDelegateC5scene_13willConnectTo7optionsySo7UISceneC_So0K7SessionCSo0K17ConnectionOptionsCtFTo + 118
15 UIKitCore 0x00007fff44221a31 +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1463
16 UIKitCore 0x00007fff4421ffb1 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1109
17 UIKitCore 0x00007fff4421ecfe -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 299
18 UIKitCore 0x00007fff4421eb49 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 358
19 FrontBoardServices 0x00007fff317e7312 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 391
20 FrontBoardServices 0x00007fff318045df __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.176 + 102
21 FrontBoardServices 0x00007fff317d60c1 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209
22 FrontBoardServices 0x00007fff318042b7 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 354
23 libdispatch.dylib 0x00000001040c50b0 _dispatch_client_callout + 8
24 libdispatch.dylib 0x00000001040c8927 _dispatch_block_invoke_direct + 286
25 FrontBoardServices 0x00007fff317d5fd8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
26 FrontBoardServices 0x00007fff3181e1c3 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 433
27 FrontBoardServices 0x00007fff317d5fa0 -[FBSSerialQueue _performNextFromRunLoopSource] + 22
28 CoreFoundation 0x00007fff204349fc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
29 CoreFoundation 0x00007fff20434964 __CFRunLoopDoSource0 + 180
30 CoreFoundation 0x00007fff204346df __CFRunLoopDoSources0 + 248
31 CoreFoundation 0x00007fff20433111 __CFRunLoopRun + 890
32 CoreFoundation 0x00007fff204326be CFRunLoopRunSpecific + 563
33 HIToolbox 0x00007fff2869efd0 RunCurrentEventLoopInMode + 292
34 HIToolbox 0x00007fff2869edcc ReceiveNextEventCommon + 709
35 HIToolbox 0x00007fff2869eaef _BlockUntilNextEventMatchingListInModeWithFilter + 64
36 AppKit 0x00007fff22c4bf85 _DPSNextEvent + 883
37 AppKit 0x00007fff22c4a74b -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1366
38 AppKit 0x00007fff22c3cbda -[NSApplication run] + 586
39 AppKit 0x00007fff22c10f31 NSApplicationMain + 816
40 AppKit 0x00007fff22f0744d _NSApplicationMainWithInfoDictionary + 16
41 UIKitMacHelper 0x00007fff3403332e UINSApplicationMain + 1418
42 UIKitCore 0x00007fff44202e30 UIApplicationMain + 144
43 AppName 0x00000001014da40b main + 75
44 libdyld.dylib 0x00007fff20357631 start + 1
)
2020-11-28 01:48:40.337802+0000 AppName[13691:435322] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Parameter was not of class UIScene.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff204ae6af __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201e63c9 objc_exception_throw + 48
2 CoreFoundation 0x00007fff204d7512 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff212906c9 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 UIKitCore 0x00007fff44a7b2c6 -[_UISceneMacHelperUtilities sceneIdentifierForUIScene:] + 195
5 UIKitMacHelper 0x00007fff34045f74 __46-[UINSApplicationDelegate _setupKeyWindowSync]_block_invoke + 393
6 Foundation 0x00007fff21192d6b -[__NSObserver _doit:] + 287
7 CoreFoundation 0x00007fff20429fdc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
8 CoreFoundation 0x00007fff204c589b ___CFXRegistrationPost_block_invoke + 49
9 CoreFoundation 0x00007fff204c580f _CFXRegistrationPost + 454
10 CoreFoundation 0x00007fff203fabce _CFXNotificationPost + 723
11 Foundation 0x00007fff21166abe -[NSNotificationCenter postNotificationName:object:userInfo:] + 59
12 UIKitCore 0x00007fff44376779 -[UIWindow _makeKeyWindowIgnoringOldKeyWindow:] + 567
13 AppName 0x00000001013fe0c0 $s25AppName13SceneDelegateC5scene_13willConnectTo7optionsySo7UISceneC_So0K7SessionCSo0K17ConnectionOptionsCtF + 1520
14 AppName 0x00000001013feaa6 $s25AppName13SceneDelegateC5scene_13willConnectTo7optionsySo7UISceneC_So0K7SessionCSo0K17ConnectionOptionsCtFTo + 118
15 UIKitCore 0x00007fff44221a31 +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1463
16 UIKitCore 0x00007fff4421ffb1 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1109
17 UIKitCore 0x00007fff4421ecfe -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 299
18 UIKitCore 0x00007fff4421eb49 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 358
19 FrontBoardServices 0x00007fff317e7312 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 391
20 FrontBoardServices 0x00007fff318045df __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.176 + 102
21 FrontBoardServices 0x00007fff317d60c1 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209
22 FrontBoardServices 0x00007fff318042b7 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 354
23 libdispatch.dylib 0x00000001040c50b0 _dispatch_client_callout + 8
24 libdispatch.dylib 0x00000001040c8927 _dispatch_block_invoke_direct + 286
25 FrontBoardServices 0x00007fff317d5fd8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
26 FrontBoardServices 0x00007fff3181e1c3 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 433
27 FrontBoardServices 0x00007fff317d5fa0 -[FBSSerialQueue _performNextFromRunLoopSource] + 22
28 CoreFoundation 0x00007fff204349fc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
29 CoreFoundation 0x00007fff20434964 __CFRunLoopDoSource0 + 180
30 CoreFoundation 0x00007fff204346df __CFRunLoopDoSources0 + 248
31 CoreFoundation 0x00007fff20433111 __CFRunLoopRun + 890
32 CoreFoundation 0x00007fff204326be CFRunLoopRunSpecific + 563
33 HIToolbox 0x00007fff2869efd0 RunCurrentEventLoopInMode + 292
34 HIToolbox 0x00007fff2869edcc ReceiveNextEventCommon + 709
35 HIToolbox 0x00007fff2869eaef _BlockUntilNextEventMatchingListInModeWithFilter + 64
36 AppKit 0x00007fff22c4bf85 _DPSNextEvent + 883
37 AppKit 0x00007fff22c4a74b -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1366
38 AppKit 0x00007fff22c3cbda -[NSApplication run] + 586
39 AppKit 0x00007fff22c10f31 NSApplicationMain + 816
40 AppKit 0x00007fff22f0744d _NSApplicationMainWithInfoDictionary + 16
41 UIKitMacHelper 0x00007fff3403332e UINSApplicationMain + 1418
42 UIKitCore 0x00007fff44202e30 UIApplicationMain + 144
43 AppName 0x00000001014da40b main + 75
44 libdyld.dylib 0x00007fff20357631 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Parameter was not of class UIScene.'
terminating with uncaught exception of type NSException
I'm very new to Swift - having some trouble doing the simple task of displaying a document in a PDFView. I am not using Storyboards or IBOutlets etc. Any idea why the below is crashing?
I have tried referencing an external link, but it gives me the same error. The PDF exists in the bundle directory.
import UIKit
import PDFKit
class ViewController: UIViewController {
private var pdfView = PDFView()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let myNewView = PDFView(frame: CGRect(x: 10, y: 100, width: 500, height: 500))
// Add border to UIView
myNewView.layer.borderWidth=2
// Change UIView Border Color to Red
myNewView.layer.borderColor = UIColor.red.cgColor
guard let path = Bundle.main.path(forResource: "CV", ofType: "pdf") else { return }
let url = URL(fileURLWithPath: path)
let document = PDFDocument(url: url)
myNewView.document = document
// Add UIView as a Subview
self.view.addSubview(myNewView)
}
}
Build succeeds. But I get the below.
2019-06-13 17:49:35.702174+0100 Appp[81235:19343962] * Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'
* First throw call stack:
(
0 CoreFoundation 0x00000001083446fb exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000106250ac5 objc_exception_throw + 48
2 CoreFoundation 0x0000000108344555 +[NSException raise:format:] + 197
3 QuartzCore 0x000000010b4072ae _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 140
4 QuartzCore 0x000000010b3f668b -[CALayer setPosition:] + 57
5 QuartzCore 0x000000010b3f6de3 -[CALayer setFrame:] + 560
6 PDFKit 0x0000000107135097 -[PDFPageLayerTile initWithFrame:forPageLayer:withRenderingTransform:tileContentsScale:generationID:] + 168
7 PDFKit 0x000000010713a805 -[PDFPageLayer _updateTiles] + 3439
8 PDFKit 0x0000000107135d8e -[PDFPageLayer setNeedsTilesUpdate] + 87
9 PDFKit 0x000000010714a97d -[PDFPageView setNeedsTilesUpdate] + 48
10 PDFKit 0x000000010714c816 -[PDFPageView setFrame:] + 334
11 PDFKit 0x000000010714311c -[PDFDocumentView createPageViewForPageAtIndex:] + 764
12 PDFKit 0x0000000107144326 -[PDFDocumentView updateVisibility] + 1726
13 PDFKit 0x00000001071b376f -[PDFView resizeDisplayView:] + 517
14 PDFKit 0x00000001071accdf -[PDFView layoutDocumentView] + 464
15 PDFKit 0x00000001071a836a -[PDFView setDocument:waitDuration:] + 1246
16 Appp 0x000000010596c4d1 $s7Appp14ViewControllerC11viewDidLoadyyF + 1441
17 Appp 0x000000010596c7b4 $s7Appp14ViewControllerC11viewDidLoadyyFTo + 36
18 UIKitCore 0x000000010d0ec43b -[UIViewController loadViewIfRequired] + 1183
19 UIKitCore 0x000000010d0ec868 -[UIViewController view] + 27
20 UIKitCore 0x000000010d724c33 -[UIWindow addRootViewControllerViewIfPossible] + 122
21 UIKitCore 0x000000010d725327 -[UIWindow _setHidden:forced:] + 289
22 UIKitCore 0x000000010d737f86 -[UIWindow makeKeyAndVisible] + 42
23 UIKitCore 0x000000010d6e7f1c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4555
24 UIKitCore 0x000000010d6ed0c6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617
25 UIKitCore 0x000000010cf326d6 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904
26 UIKitCore 0x000000010cf3afce +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
27 UIKitCore 0x000000010cf322ec -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
28 UIKitCore 0x000000010cf32c48 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091
29 UIKitCore 0x000000010cf30fba __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
30 UIKitCore 0x000000010cf30c71 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
31 UIKitCore 0x000000010cf359b6 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
32 UIKitCore 0x000000010cf36610 _performActionsWithDelayForTransitionContext + 100
33 UIKitCore 0x000000010cf3571d -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
34 UIKitCore 0x000000010cf3a6d0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
35 UIKitCore 0x000000010d6eb9a8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
36 UIKitCore 0x000000010d2a2dfa -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
37 FrontBoardServices 0x00000001135df125 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
38 FrontBoardServices 0x00000001135e8ed6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283
39 FrontBoardServices 0x00000001135e8700 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
40 libdispatch.dylib 0x00000001096d7db5 _dispatch_client_callout + 8
41 libdispatch.dylib 0x00000001096db2ba _dispatch_block_invoke_direct + 300
42 FrontBoardServices 0x000000011361a146 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 30
43 FrontBoardServices 0x0000000113619dfe -[FBSSerialQueue _performNext] + 451
44 FrontBoardServices 0x000000011361a393 -[FBSSerialQueue _performNextFromRunLoopSource] + 42
45 CoreFoundation 0x00000001082abbe1 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
46 CoreFoundation 0x00000001082ab463 __CFRunLoopDoSources0 + 243
47 CoreFoundation 0x00000001082a5b1f __CFRunLoopRun + 1231
48 CoreFoundation 0x00000001082a5302 CFRunLoopRunSpecific + 626
49 GraphicsServices 0x00000001107c62fe GSEventRunModal + 65
50 UIKitCore 0x000000010d6eeba2 UIApplicationMain + 140
51 Appp 0x000000010596f68b main + 75
52 libdyld.dylib 0x000000010974c541 start + 1
53 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
If you move myNewView.document = document to viewDidAppear: instead of viewDidLoad, the document will load without issue.
Unfortunately, there were changes to iOS between 12.1 and 12.2 that make this necessary.
I've search for some other question/solutions here but can't fix this issue in my App. I can't figure out what is the issue. It was working properly.
When I run my app on Actual Device or on Simulator it crashes on the splash screen. Here is the crash log.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRMessaging client not setup.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010cfd71bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010c0f9735 objc_exception_throw + 48
2 CoreFoundation 0x000000010cfd6f42 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000109abc940 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
4 Tarfeeh 0x0000000106e7ee9c -[FIRMessaging connectWithCompletion:] + 556
5 Tarfeeh 0x0000000106dcb573 $S7Tarfeeh11AppDelegateC12connectToFcmyyF + 579
6 Tarfeeh 0x0000000106cd900f $S7Tarfeeh11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF + 2431
7 Tarfeeh 0x0000000106cd97f4 $S7Tarfeeh11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtFTo + 228
8 UIKitCore 0x000000011290ebde -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 280
9 UIKitCore 0x00000001129105cb -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3979
10 UIKitCore 0x0000000112915c2f -[UIApplication _runWithMainScene:transitionContext:completion:] + 1623
11 UIKitCore 0x00000001121344e9 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
12 UIKitCore 0x000000011213d29c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
13 UIKitCore 0x0000000112134126 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233
14 UIKitCore 0x0000000112134ae0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085
15 UIKitCore 0x0000000112132cb5 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 795
16 UIKitCore 0x000000011213295f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435
17 UIKitCore 0x0000000112137a90 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 584
18 UIKitCore 0x000000011213880e _performActionsWithDelayForTransitionContext + 100
19 UIKitCore 0x00000001121377ef -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 221
20 UIKitCore 0x000000011213c93a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
21 UIKitCore 0x000000011291444e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
22 UIKitCore 0x00000001124b8d09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357
23 FrontBoardServices 0x00000001183da2da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
24 FrontBoardServices 0x00000001183e5443 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271
25 FrontBoardServices 0x00000001183e4b3a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
26 libdispatch.dylib 0x000000010f016602 _dispatch_client_callout + 8
27 libdispatch.dylib 0x000000010f019b78 _dispatch_block_invoke_direct + 301
28 FrontBoardServices 0x0000000118419ba8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
29 FrontBoardServices 0x0000000118419860 -[FBSSerialQueue _performNext] + 457
30 FrontBoardServices 0x0000000118419e40 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
31 CoreFoundation 0x000000010cf3c721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
32 CoreFoundation 0x000000010cf3bf93 __CFRunLoopDoSources0 + 243
33 CoreFoundation 0x000000010cf3663f __CFRunLoopRun + 1263
34 CoreFoundation 0x000000010cf35e11 CFRunLoopRunSpecific + 625
35 GraphicsServices 0x00000001154a61dd GSEventRunModal + 62
36 UIKitCore 0x000000011291781d UIApplicationMain + 140
37 Tarfeeh 0x0000000106cdab44 main + 68
38 libdyld.dylib 0x000000010f08c575 start + 1
39 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I just updated my podfile and it stopped working. I can't revert back to old version.
Add FirebaseApp.configure() in Your AppDelegate when starting application.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
}
I'm trying to convert CGEvent to NSEvent using NSEvent(cgEvent: event) in order to get the characters of key press, but I get the error saying it's an "Invalid event." My code and the error message are below. Any help would b eappreciated. Thanks!
func myCGEventCallback(proxy : CGEventTapProxy, type : CGEventType, event : CGEvent, refcon : UnsafeMutableRawPointer?) -> Unmanaged<CGEvent>? {
if type == .keyDown {
if let other = NSEvent(cgEvent: event), let chars = other.characters {
debugPrint(chars)
}
}
return Unmanaged.passRetained(event)
}
2017-06-10 23:18:14.233831-0400 RemapEvent[54431:3082409] [default] Invalid event.
2017-06-10 23:18:14.233938-0400 RemapEvent[54431:3082409] *** Assertion failure in -[NSEvent characters], /Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1504.83.101/AppKit.subproj/NSEvent.m:2414
2017-06-10 23:18:14.234153-0400 RemapEvent[54431:3082409] [General] Invalid message sent to event "NSEvent: type=FlagsChanged loc=(580,464.336) time=116091.6 flags=0x40101 win=0x0 winNum=0 ctxt=0x0 keyCode=59"
2017-06-10 23:18:14.234965-0400 RemapEvent[54431:3082409] [General] (
0 CoreFoundation 0x00007fffa16c62cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fffb64d148d objc_exception_throw + 48
2 CoreFoundation 0x00007fffa16cb042 +[NSException raise:format:arguments:] + 98
3 Foundation 0x00007fffa3113c80 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 AppKit 0x00007fff9f2caa64 -[NSEvent characters] + 174
5 RemapEvent 0x0000000100003da9 _TFFC10RemapEvent14ViewController11viewDidLoadFT_T_L_17myCGEventCallbackFT5proxyVs13OpaquePointer4typeOSC11CGEventType5eventCSo7CGEvent6refconGSqSv__GSqGVs9UnmanagedS3___ + 473
6 RemapEvent 0x0000000100004877 _TToFFC10RemapEvent14ViewController11viewDidLoadFT_T_L_17myCGEventCallbackFT5proxyVs13OpaquePointer4typeOSC11CGEventType5eventCSo7CGEvent6refconGSqSv__GSqGVs9UnmanagedS3___ + 55
7 SkyLight 0x00007fffb32c0dca processDecodedEventRef + 204
8 SkyLight 0x00007fffb32c05b4 processEventTapData + 544
9 SkyLight 0x00007fffb319e6db _XPostEventTapData + 280
10 SkyLight 0x00007fffb32c033e eventTapMessageHandler + 137
11 CoreFoundation 0x00007fffa16451ed __CFMachPortPerform + 253
12 CoreFoundation 0x00007fffa16450d9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
13 CoreFoundation 0x00007fffa1645051 __CFRunLoopDoSource1 + 465
14 CoreFoundation 0x00007fffa163ccc5 __CFRunLoopRun + 2389
15 CoreFoundation 0x00007fffa163c114 CFRunLoopRunSpecific + 420
16 HIToolbox 0x00007fffa0b9debc RunCurrentEventLoopInMode + 240
17 HIToolbox 0x00007fffa0b9dcf1 ReceiveNextEventCommon + 432
18 HIToolbox 0x00007fffa0b9db26 _BlockUntilNextEventMatchingListInModeWithFilter + 71
19 AppKit 0x00007fff9f136a54 _DPSNextEvent + 1120
20 AppKit 0x00007fff9f8b27ee -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2796
21 AppKit 0x00007fff9f12b3db -[NSApplication run] + 926
22 AppKit 0x00007fff9f0f5e0e NSApplicationMain + 1237
23 RemapEvent 0x000000010000648d main + 13
24 libdyld.dylib 0x00007fffb6db6235 start + 1
)
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