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.
Related
With iOS 16, I have fatal error when I launch VNDocumentCameraViewController
(iPad or iPhone)
On my project, with older operating system (like iOS 14, iOS 15) I haven't got this error.
info.plist --> NSCameraUsageDescription is present with description
let myScanViewController = VNDocumentCameraViewController()
myScanViewController.delegate = self
self.present(myScanViewController, animated: false)
I's happen just after self.present and I haven't got the camera screen.
I do not know where to check and where to add a breakpoint
debug message :
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
I check the backtraces but any idea about the problem.
thank you for your help.
0 CoreFoundation 0x18add6248 __exceptionPreprocess + 164
1 libobjc.A.dylib 0x1841a3a68 objc_exception_throw + 60
2 CoreFoundation 0x18af7a6d4 -[__NSCFString characterAtIndex:].cold.1 + 0
3 CoreFoundation 0x18af77a74 -[__NSPlaceholderArray initWithCapacity:].cold.1 + 0
4 CoreFoundation 0x18add1828 -[__NSPlaceholderArray initWithObjects:count:] + 252
5 CoreFoundation 0x18add2b1c +[NSArray arrayWithObjects:count:] + 40
6 UIKitCore 0x18d387f5c +[UIImageSymbolConfiguration configurationWithHierarchicalColor:] + 124
7 UIKitCore 0x18d7ffd60 -[_UIImageCUIVectorGlyphContent _automaticSymbolConfiguration] + 104
8 UIKitCore 0x18cff6434 -[UIImageView _symbolConfigurationForImage:] + 72
9 UIKitCore 0x18cfc77cc -[UIImageView _resolvedImageFromImage:forTrait:] + 96
10 UIKitCore 0x18cf941fc -[UIImageView _resolvedImageFromImage:] + 152
11 UIKitCore 0x18cf92d5c -[UIButtonLegacyVisualProvider intrinsicSizeWithinSize:] + 132
12 UIKitCore 0x18cf92cb4 -[UIButton _intrinsicSizeWithinSize:] + 52
13 UIKitCore 0x18cfcd04c -[UIView(UIConstraintBasedLayout) intrinsicContentSize] + 120
14 UIKitCore 0x18cfcd598 -[UIButton intrinsicContentSize] + 148
15 UIKitCore 0x18cfccbe0 -[UIView _generateContentSizeConstraints] + 52
16 UIKitCore 0x18cfb74a8 -[UIView _updateContentSizeConstraints] + 244
17 UIKitCore 0x18d04b4a4 -[UIView(AdditionalLayoutSupport) _updateSystemConstraints] + 88
18 UIKitCore 0x18d0c9700 -[UIButton updateConstraints] + 72
19 UIKitCore 0x18d04b378 -[UIView(AdditionalLayoutSupport) _sendUpdateConstraintsIfNecessaryForSecondPass:] + 348
20 UIKitCore 0x18d04b110 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 764
21 UIKitCore 0x18d04b02c -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 536
22 UIKitCore 0x18d04b02c -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 536
23 UIKitCore 0x18d04b02c -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 536
24 CoreAutoLayout 0x1a72a7e90 -[NSISEngine withBehaviors:performModifications:] + 84
25 UIKitCore 0x18d04ae08 __100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke + 104
26 UIKitCore 0x18cfed6e8 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 96
27 UIKitCore 0x18cfed350 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 172
28 UIKitCore 0x18cfecf50 -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 388
29 UIKitCore 0x18d02cdec -[UIView(Hierarchy) layoutBelowIfNeeded] + 1064
30 DocumentCamera 0x1edf3c6c4 -[ICDocCamViewController initializeUserInterface] + 656
31 DocumentCamera 0x1edf3baa4 -[ICDocCamViewController viewDidLoad] + 1044
32 UIKitCore 0x18d2dd330 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 84
33 UIKitCore 0x18cf750a8 -[UIViewController loadViewIfRequired] + 712
34 UIKitCore 0x18d23c1bc -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 124
35 UIKitCore 0x18d1025ec -[UINavigationController _startTransition:fromViewController:toViewController:] + 196
36 UIKitCore 0x18d101aa4 -[UINavigationController _startDeferredTransitionIfNeeded:] + 608
37 UIKitCore 0x18d1010f4 -[UINavigationController __viewWillLayoutSubviews] + 96
38 UIKitCore 0x18d101058 -[UILayoutContainerView layoutSubviews] + 172
39 UIKitCore 0x18cf5ecec -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1980
40 QuartzCore 0x18c43b4e8 CA::Layer::layout_if_needed(CA::Transaction*) + 500
41 QuartzCore 0x18c44eb9c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148
42 QuartzCore 0x18c460098 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 456
43 QuartzCore 0x18c4973c4 CA::Transaction::commit() + 652
44 QuartzCore 0x18c47e408 CA::Transaction::flush_as_runloop_observer(bool) + 88
45 CoreFoundation 0x18ae5e070 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
46 CoreFoundation 0x18ade6690 __CFRunLoopDoObservers + 532
47 CoreFoundation 0x18ae47f8c __CFRunLoopRun + 1048
48 CoreFoundation 0x18ae4d1e4 CFRunLoopRunSpecific + 612
49 GraphicsServices 0x1c3c6d368 GSEventRunModal + 164
50 UIKitCore 0x18d2fcd88 -[UIApplication _run] + 888
51 UIKitCore 0x18d2fc9ec UIApplicationMain + 340
52 digitrame 0x1019c8d88 main + 64
53 dyld 0x1a9171948 start + 2504
After deconstruct all the projet....the package SumUp (install via pod) is causing the crash....the backtraces is really not explicit about this fatal error !!!!
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 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!
I have some problems with adding an audio player to a node. For some reason, I get an exception and my application stops. Here is how my code looks like
let node = scene.rootNode.childNodeWithName("box", recursively: true)!
let source = SCNAudioSource(fileNamed: "test.mp3")
source.loops = true
source.volume = 2
source.positional = true
source.shouldStream = true
source.load()
let player = SCNAudioPlayer(source: source)
node.addAudioPlayer(player)
Can anybody help me find out what is the problem?
Edit: Exception:
2015-06-12 10:44:29.202 asd[10480:2157476] 10:44:29.202 ERROR: AVAudioNodeImpl.h:39: AVAE_CheckNodeHasEngine: required condition is false: _engine != nil
2015-06-12 10:44:29.208 asd[10480:2157476] * Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: _engine != nil'
* First throw call stack:
(
0 CoreFoundation 0x000000010ca18885 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010e9afdf1 objc_exception_throw + 48
2 CoreFoundation 0x000000010ca186ea +[NSException raise:format:arguments:] + 106
3 libAVFAudio.dylib 0x0000000115549efe libAVFAudio.dylib + 98046
4 libAVFAudio.dylib 0x000000011558b4fd libAVFAudio.dylib + 365821
5 libAVFAudio.dylib 0x000000011558aaa5 libAVFAudio.dylib + 363173
6 SceneKit 0x000000010d3695eb C3DTransactionFlush + 1967
7 SceneKit 0x000000010d3699e9 C3DTransactionCommit + 218
8 SceneKit 0x000000010d2f7f6e -[SCNRenderer setPointOfView:] + 4677
9 SceneKit 0x000000010d2f8c05 -[SCNRenderer setScene:completionHandler:] + 213
10 SceneKit 0x000000010d354920 -[SCNView setScene:] + 319
11 asd 0x000000010c8338b2 _TFC3asd18GameViewController11viewDidLoadfS0_FT_T_ + 2866
12 asd 0x000000010c833ba2 _TToFC3asd18GameViewController11viewDidLoadfS0_FT_T_ + 34
13 UIKit 0x000000010d7bbd65 -[UIViewController loadViewIfRequired] + 860
14 UIKit 0x000000010d7bc0b4 -[UIViewController view] + 27
15 UIKit 0x000000010d69f3d4 -[UIWindow addRootViewControllerViewIfPossible] + 61
16 UIKit 0x000000010d69fad1 -[UIWindow _setHidden:forced:] + 302
17 UIKit 0x000000011c867717 UIKit + 247575
18 UIKit 0x000000010d6b0ff8 -[UIWindow makeKeyAndVisible] + 43
19 UIKit 0x000000010d63302b -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3545
20 UIKit 0x000000010d638ef0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1755
21 UIKit 0x000000010d63673f -[UIApplication workspaceDidEndTransaction:] + 188
22 FrontBoardServices 0x0000000116052d7b FrontBoardServices + 163195
23 FrontBoardServices 0x0000000116053118 FrontBoardServices + 164120
24 CoreFoundation 0x000000010c9430f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
25 CoreFoundation 0x000000010c938eac __CFRunLoopDoSources0 + 556
26 CoreFoundation 0x000000010c938363 __CFRunLoopRun + 867
27 CoreFoundation 0x000000010c937d78 CFRunLoopRunSpecific + 488
28 UIKit 0x000000010d636091 -[UIApplication _run] + 402
29 UIKit 0x000000010d63a79b UIApplicationMain + 171
30 asd 0x000000010c83624d main + 109
31 libdyld.dylib 0x000000010f3a0a05 libdyld.dylib + 10757
32 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Try using SCNAction. Or making sure the audio file name is correct.
let source = SCNAudioSource(fileNamed: "SoundFile.mp3")
let action = SCNAction.playAudio(source!, waitForCompletion: true)
node.runAction(action)
I have this log error when I tap in a uisearchbar (ios 7)
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSBigMutableString replaceCharactersInRange:withString:]: nil argument'
*** First throw call stack:
(
0 CoreFoundation 0x02c905e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x02a138b6 objc_exception_throw + 44
2 CoreFoundation 0x02c903bb +[NSException raise:format:] + 139
3 Foundation 0x0243863e -[NSBigMutableString replaceCharactersInRange:withString:] + 117
4 Foundation 0x02438595 -[NSConcreteMutableAttributedString replaceCharactersInRange:withAttributedString:] + 384
5 UIFoundation 0x077b49f4 __71-[NSConcreteTextStorage replaceCharactersInRange:withAttributedString:]_block_invoke + 68
6 UIFoundation 0x077b492f -[NSConcreteTextStorage replaceCharactersInRange:withAttributedString:] + 121
7 Foundation 0x02462d46 -[NSMutableAttributedString setAttributedString:] + 90
8 UIKit 0x016794e2 __65-[UIFieldEditor setAttributedText:andSetCaretSelectionAfterText:]_block_invoke + 53
9 UIFoundation 0x077b2491 -[NSTextStorage coordinateEditing:] + 48
10 UIKit 0x01679375 -[UIFieldEditor setAttributedText:andSetCaretSelectionAfterText:] + 151
11 UIKit 0x0167969b -[UIFieldEditor setAttributedText:] + 48
12 UIKit 0x01c5e3f5 -[UITextField willAttachFieldEditor:] + 340
13 UIKit 0x016784d5 -[UIFieldEditor becomeFieldEditorForView:] + 927
14 UIKit 0x01c55643 -[UITextField _becomeFirstResponder] + 160
15 UIKit 0x0184441a -[UISearchBarTextField _becomeFirstResponder] + 98
16 UIKit 0x01c554a1 -[UITextField __resumeBecomeFirstResponder] + 53
17 UIKit 0x0184466e __45-[UISearchBarTextField _becomeFirstResponder]_block_invoke + 259
18 UIKit 0x01844563 -[UISearchBarTextField _becomeFirstResponder] + 427
19 UIKit 0x016d2585 -[UIResponder becomeFirstResponder] + 400
20 UIKit 0x015d5d0b -[UIView(Hierarchy) becomeFirstResponder] + 114
21 UIKit 0x01c550e3 -[UITextField becomeFirstResponder] + 51
22 UIKit 0x018415b0 -[UISearchBar(UISearchBarStatic) becomeFirstResponder] + 42
23 UIKit 0x0183f9ef -[UISearchBar tappedSearchBar:] + 57
24 UIKit 0x018f0f8c _UIGestureRecognizerSendActions + 230
25 UIKit 0x018efc00 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 383
26 UIKit 0x018f166d -[UIGestureRecognizer _delayedUpdateGesture] + 60
27 UIKit 0x018f4bcd ___UIGestureRecognizerUpdate_block_invoke + 57
28 UIKit 0x018f4b4e _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317
29 UIKit 0x018eb248 _UIGestureRecognizerUpdate + 199
30 UIKit 0x015b7d4a -[UIWindow _sendGesturesForEvent:] + 1291
31 UIKit 0x015b8c6a -[UIWindow sendEvent:] + 1030
32 UIKit 0x0158ca36 -[UIApplication sendEvent:] + 242
33 UIKit 0x01576d9f _UIApplicationHandleEventQueue + 11421
34 CoreFoundation 0x02c198af __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
35 CoreFoundation 0x02c1923b __CFRunLoopDoSources0 + 235
36 CoreFoundation 0x02c3630e __CFRunLoopRun + 910
37 CoreFoundation 0x02c35b33 CFRunLoopRunSpecific + 467
38 CoreFoundation 0x02c3594b CFRunLoopRunInMode + 123
39 GraphicsServices 0x0302d9d7 GSEventRunModal + 192
40 GraphicsServices 0x0302d7fe GSEventRun + 104
41 UIKit 0x0157994b UIApplicationMain + 1225
42 Mobile4Job 0x00002b5d main + 141
43 libdyld.dylib 0x03451725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I never see something like that and I can't fix it.
From the stack trace a assume that you want to rebuild the text entered in the search bar, and you try to replace a string in a range with other string, and it seems that your other string is nil. Please check the the string that you are using, one of them is nil
I found the problem, I have an UITextfield implementation:
#implementation UITextField (clearCustomButton)
- (id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
}
return self;
}
- (void)awakeFromNib{
self.clearButtonMode = UITextFieldViewModeWhileEditing;
}
- (CGRect)clearButtonRectForBounds:(CGRect)bounds{
return CGRectMake(bounds.size.width - 20, (bounds.size.height - 14)/2, 14, 14);
}
#end
if I delete :
- (id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
}
return self;
}
it works. By the way, thanks to #danypata