I have an .
xcassets
folder containing Colours. The target membership of the folder is same as my project. As are all the colours inside the folder.In code I access with
UIColor(named:)
var colour = UIColor(named: "<#a colour that exists with this name#>")
but I get a
Thread 1: EXC_BAD_ACCESS (code=1, address=0x8)
I am having same uses trying to access images from a separate .
xcassets
folder.Colours and Images exist yet Xcode crashes.Its as if the colours and images don't exist but they do.
I have tried removing and re-adding the colours and images buts same useless error each time.
included the backtrace
> (lldb) bt
> * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
> frame #0: 0x000000018c3510f0 CoreUI`-[CUINamedColor cgColor] + 88
> frame #1: 0x000000018ed957d8 UIKit`-[_UIAssetManager colorNamed:withTraitCollection:] + 248
> frame #2: 0x000000018e77cda8 UIKit`+[UIColor(UIColorNamedColors) colorNamed:inBundle:compatibleWithTraitCollection:] + 168
> frame #3: 0x00000001022d71b8 MY_APPLICATION_NAME`@nonobjc UIColor.__allocating_init(named:) at ViewController.swift:0 * frame
> #4: 0x00000001022d69d4 MY_APPLICATION_NAME`ViewController.pickerView(pickerView=0x0000000103314930,
> row=0, component=0, view=nil, self=0x000000010330f2b0) at
> ViewController.swift:117
> frame #5: 0x00000001022d73cc MY_APPLICATION_NAME`@objc ViewController.pickerView(_:viewForRow:forComponent:reusing:) at
> ViewController.swift:0
> frame #6: 0x000000018e539a30 UIKit`-[UIPickerView tableView:cellForRowAtIndexPath:] + 616
> frame #7: 0x000000018ed5d6ac UIKit`-[UIPickerColumnView tableView:cellForRowAtIndexPath:] + 168
> frame #8: 0x000000018e6180e8 UIKit`-[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 668
> frame #9: 0x000000018e61864c UIKit`-[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
> frame #10: 0x000000018e5f82e4 UIKit`-[UITableView _updateVisibleCellsNow:isRecursive:] + 2140
> frame #11: 0x000000018e602888 UIKit`-[UITableView _cellForRowAtIndexPath:usingPresentationValues:] + 232
> frame #12: 0x000000018e3fdbb8 UIKit`-[UITableView cellForRowAtIndexPath:] + 76
> frame #13: 0x000000018eba84d4 UIKit`-[UIPickerTableView selectRow:animated:notify:updateChecked:] + 352
> frame #14: 0x000000018e5383d4 UIKit`-[UIPickerView _resetSelectionOfTables] + 184
> frame #15: 0x000000018e538258 UIKit`__30-[UIPickerView layoutSubviews]_block_invoke + 6612
> frame #16: 0x000000018e2f2480 UIKit`+[UIView(Animation) performWithoutAnimation:] + 104
> frame #17: 0x000000018e53683c UIKit`-[UIPickerView layoutSubviews] + 152
> frame #18: 0x000000018e5392ec UIKit`-[UIPickerView selectedRowInComponent:] + 52
> frame #19: 0x000000018e534d94 UIKit`-[UIPickerView _updateSelectedRows] + 144
> frame #20: 0x000000018e534e44 UIKit`-[UIPickerView didMoveToWindow] + 104
> frame #21: 0x000000018e2e1178 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 1496
> frame #22: 0x000000018e2e0e68 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 712
> frame #23: 0x000000018e2e0e68 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 712
> frame #24: 0x000000018e2e0324 UIKit`__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 156
> frame #25: 0x000000018e2e017c UIKit`-[UIView(Hierarchy) _postMovedFromSuperview:] + 796
> frame #26: 0x000000018e2ebd98 UIKit`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 1728
> frame #27: 0x000000018e2eafd0 UIKit`-[UIWindow addRootViewControllerViewIfPossible] + 688
> frame #28: 0x000000018e2e8014 UIKit`-[UIWindow _setHidden:forced:] + 272
> frame #29: 0x000000018e3579f8 UIKit`-[UIWindow makeKeyAndVisible] + 48
> frame #30: 0x000000018e5471b4 UIKit`-[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3616
> frame #31: 0x000000018e54bf44 UIKit`-[UIApplication _runWithMainScene:transitionContext:completion:] + 1712
> frame #32: 0x000000018e7cb5c8 UIKit`__111-[__UICanvasLifecycleMonitor_Compatability
> _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke
> + 800
> frame #33: 0x000000018ea91bb0 UIKit`+[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 160
> frame #34: 0x000000018e7cb22c UIKit`-[__UICanvasLifecycleMonitor_Compatability
> _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 252
> frame #35: 0x000000018e7cba9c UIKit`-[__UICanvasLifecycleMonitor_Compatability
> activateEventsOnly:withContext:completion:] + 748
> frame #36: 0x000000018ef15c24 UIKit`__82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke
> + 260
> frame #37: 0x000000018ef15ac8 UIKit`-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 448
> frame #38: 0x000000018eca00b0 UIKit`__125-[_UICanvasLifecycleSettingsDiffAction
> performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke
> + 220
> frame #39: 0x000000018ee30290 UIKit`_performActionsWithDelayForTransitionContext + 112
> frame #40: 0x000000018ec9ff60 UIKit`-[_UICanvasLifecycleSettingsDiffAction
> performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]
> + 252
> frame #41: 0x000000018ea91210 UIKit`-[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 364
> frame #42: 0x000000018e54a688 UIKit`-[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 540
> frame #43: 0x000000018e938c24 UIKit`-[UIApplicationSceneClientAgent
> scene:didInitializeWithEvent:completion:] + 364
> frame #44: 0x00000001875e6968 FrontBoardServices`-[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 364
> frame #45: 0x00000001875ef270 FrontBoardServices`__56-[FBSWorkspace
> client:handleCreateScene:withCompletion:]_block_invoke_2 + 224
> frame #46: 0x000000010317d45c libdispatch.dylib`_dispatch_client_callout + 16
> frame #47: 0x0000000103189b74 libdispatch.dylib`_dispatch_block_invoke_direct + 268
> frame #48: 0x000000018761ab04 FrontBoardServices`__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
> frame #49: 0x000000018761a7a8 FrontBoardServices`-[FBSSerialQueue _performNext] + 404
> frame #50: 0x000000018761ad44 FrontBoardServices`-[FBSSerialQueue _performNextFromRunLoopSource] + 56
> frame #51: 0x0000000184ef8358 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
> + 24
> frame #52: 0x0000000184ef82d8 CoreFoundation`__CFRunLoopDoSource0 + 88
> frame #53: 0x0000000184ef7b60 CoreFoundation`__CFRunLoopDoSources0 + 204
> frame #54: 0x0000000184ef5738 CoreFoundation`__CFRunLoopRun + 1048
> frame #55: 0x0000000184e162d8 CoreFoundation`CFRunLoopRunSpecific + 436
> frame #56: 0x0000000186c9cf84 GraphicsServices`GSEventRunModal + 100
> frame #57: 0x000000018e34827c UIKit`UIApplicationMain + 208
> frame #58: 0x00000001022e147c MY_APPLICATION_NAME`main at AppDelegate.swift:12
> frame #59: 0x000000018493a56c libdyld.dylib`start + 4 (lldb)