Too many keypaths error - CoreData/SwiftUI/Xcode - swiftui

I have been trying to start a project with Core Data so I can store data across multiple sessions of my app, but Xcode has been generating the error "currently unsupported (too many keypaths)" whenever I try to run a simulation of the app. I'm using Xcode and SwiftUI to build this.
I've looked online to see if I was implementing Core Data incorrectly, and followed several tutorials to create even a simple CoreData app. These do not fix the problem. I'm convinced it's something with my data model after I used Apple's blank Core Data template and added the entity (without changing the actual code). This still generated the error. The code that I used:
//
// EducationAppApp.swift
// EducationApp
//
// Created by <name> on 11/26/22.
//
import SwiftUI
import CoreData
#main
struct EducationAppApp: App {
#StateObject private var dataController = DataController()
var body: some Scene {
WindowGroup {
ContentView()
.environment(\.managedObjectContext, dataController.container.viewContext)
}
}
}
The ContentView file (it's only displaying "Hello World" after trying to fetch the data):
//
// ContentView.swift
// EducationApp
//
// Created by <name> on 11/26/22.
//
import SwiftUI
import CoreData
struct ContentView: View {
#Environment(\.managedObjectContext) var managedObjContext
#FetchRequest(sortDescriptors: []) var skills: FetchedResults<Skill>
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
}
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Here is my DataController object (created with help from this tutorial):
//
// DataController.swift
// EducationApp
//
// Created by <name> on 11/26/22.
//
import Foundation
import CoreData
class DataController: ObservableObject {
// Responsible for preparing a model
let container = NSPersistentContainer(name: "SkillModel")
init() {
container.loadPersistentStores { description, error in
if let error = error {
print("Failed to load data in DataController \(error.localizedDescription)")
}
}
}
func save(context: NSManagedObjectContext) {
do {
try context.save()
print("Data saved successfully. WUHU!!!")
} catch {
// Handle errors in our database
let nsError = error as NSError
fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
}
}
}
I do believe the problem is in the data model, which looks like this:
What the SkillModel screen looks like
If anybody could provide me with a reason why this might be occurring, I would greatly appreciate it!
*Note: the error doesn't seem to be occurring in any specific point in the app, just where it says "#main".
Full error text:
2022-11-26 17:08:19.888256-0600 EducationApp[35295:826163] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'currently unsupported (too many keypaths)'
*** First throw call stack:
(
0 CoreFoundation 0x00007ff800427378 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff80004dbaf objc_exception_throw + 48
2 CoreData 0x00007ff8048c41ee +[NSSQLDerivedAttributeSQLGenerator generateSQLForDerivedAttribute:keypaths:] + 490
3 CoreData 0x00007ff804ae0526 __61-[NSSQLEntity_DerivedAttributesExtension _generateTriggerSQL]_block_invoke + 55
4 CoreFoundation 0x00007ff800371d12 __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__ + 7
5 CoreFoundation 0x00007ff800372279 ____NSDictionaryEnumerate_block_invoke.11 + 50
6 CoreFoundation 0x00007ff80045dc4b CFBasicHashApply + 143
7 CoreFoundation 0x00007ff800371e32 __NSDictionaryEnumerate + 183
8 CoreData 0x00007ff804ae0429 -[NSSQLEntity_DerivedAttributesExtension _generateTriggerSQL] + 295
9 CoreData 0x00007ff804a2734b -[NSSQLiteConnection createTriggersForEntities:] + 305
10 CoreData 0x00007ff804a279d7 -[NSSQLiteConnection createTablesForEntities:] + 841
11 CoreData 0x00007ff804a20dc3 -[NSSQLiteConnection connect] + 3924
12 CoreData 0x00007ff8049e5ced __32-[NSSQLCore _loadAndSetMetadata]_block_invoke + 103
13 CoreData 0x00007ff804a24477 __37-[NSSQLiteConnection performAndWait:]_block_invoke + 28
14 libdispatch.dylib 0x000000010c268f5b _dispatch_client_callout + 8
15 libdispatch.dylib 0x000000010c27ad72 _dispatch_lane_barrier_sync_invoke_and_complete + 132
16 CoreData 0x00007ff804a23e7f -[NSSQLiteConnection performAndWait:] + 143
17 CoreData 0x00007ff8049e612d -[NSSQLCore loadMetadata:] + 270
18 CoreData 0x00007ff80499e1e7 __91-[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:]_block_invoke + 3311
19 CoreData 0x00007ff8049b1bdd gutsOfBlockToNSPersistentStoreCoordinatorPerform + 182
20 libdispatch.dylib 0x000000010c268f5b _dispatch_client_callout + 8
21 libdispatch.dylib 0x000000010c27ad72 _dispatch_lane_barrier_sync_invoke_and_complete + 132
22 CoreData 0x00007ff804999ae1 _perform + 174
23 CoreData 0x00007ff80499d0a8 -[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:] + 418
24 CoreData 0x00007ff80499c660 -[NSPersistentStoreCoordinator _doAddPersistentStoreWithDescription:privateCopy:completeOnMainThread:withHandler:] + 523
25 CoreData 0x00007ff80499ce92 -[NSPersistentStoreCoordinator addPersistentStoreWithDescription:completionHandler:] + 227
26 CoreData 0x00007ff804ae26d0 -[NSPersistentContainer _loadStoreDescriptions:withCompletionHandler:] + 272
27 CoreData 0x00007ff804ae2599 -[NSPersistentContainer loadPersistentStoresWithCompletionHandler:] + 398
28 EducationApp 0x000000010bd0bd42 $s12EducationApp14DataControllerCACycfc + 194
29 EducationApp 0x000000010bd0bc71 $s12EducationApp14DataControllerCACycfC + 33
30 EducationApp 0x000000010bd0c9e8 $s12EducationApp0abB0V15_dataController33_6EFB69B0CC1C2615428985B99CE4CBCALL7SwiftUI11StateObjectVyAA04DataD0CGvpfiAJycfu_AJycfu0_ + 24
31 SwiftUI 0x000000011065dea7 __swift_memcpy25_8 + 107639
32 SwiftUI 0x0000000110ebfa15 _swift_stdlib_malloc_size + 24560
33 SwiftUI 0x0000000110ebef63 _swift_stdlib_malloc_size + 21822
34 SwiftUI 0x0000000110a3290e block_destroy_helper + 16524
35 SwiftUI 0x00000001100df478 __swift_memcpy1_1 + 58428
36 AttributeGraph 0x00007ff81f5a21d7 _ZN2AG5Graph11UpdateStack6updateEv + 537
37 AttributeGraph 0x00007ff81f5a29ab _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 443
38 AttributeGraph 0x00007ff81f5aa4f5 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 395
39 AttributeGraph 0x00007ff81f5c19f1 AGGraphGetValue + 218
40 SwiftUI 0x0000000110a32459 block_destroy_helper + 15319
41 SwiftUI 0x0000000110a3251d block_destroy_helper + 15515
42 SwiftUI 0x00000001100df478 __swift_memcpy1_1 + 58428
43 AttributeGraph 0x00007ff81f5a21d7 _ZN2AG5Graph11UpdateStack6updateEv + 537
44 AttributeGraph 0x00007ff81f5a29ab _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 443
45 AttributeGraph 0x00007ff81f5aa4f5 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 395
46 AttributeGraph 0x00007ff81f5c19f1 AGGraphGetValue + 218
47 SwiftUI 0x0000000110a54093 get_witness_table 7SwiftUI4ViewRzlAA15ModifiedContentVyxAA25ComplicationIdiomModifierVGAaBHPxAaBHD1__AfA0cH0HPyHCHCTm + 65867
48 SwiftUI 0x0000000110a54147 get_witness_table 7SwiftUI4ViewRzlAA15ModifiedContentVyxAA25ComplicationIdiomModifierVGAaBHPxAaBHD1__AfA0cH0HPyHCHCTm + 66047
49 SwiftUI 0x000000011007ebcc objectdestroy.3084Tm + 22953
50 AttributeGraph 0x00007ff81f5a21d7 _ZN2AG5Graph11UpdateStack6updateEv + 537
51 AttributeGraph 0x00007ff81f5a29ab _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 443
52 AttributeGraph 0x00007ff81f5a9dbf _ZN2AG5Graph9value_refENS_11AttributeIDEPK15AGSwiftMetadataRh + 123
53 AttributeGraph 0x00007ff81f5c1a36 AGGraphGetValue + 287
54 SwiftUI 0x000000011016efe4 get_witness_table 7SwiftUI18DynamicViewContentRzlAA08ModifiedE0VyxAA21_TraitWritingModifierVyAA08OnDeleteG3KeyVGGAaBHPxAaBHD1__AiA0dI0HPyHCHCTm + 21338
55 SwiftUI 0x000000011106d2c5 block_destroy_helper.188 + 46430
56 SwiftUI 0x0000000111068845 block_destroy_helper.188 + 27358
57 SwiftUI 0x00000001110693e0 block_destroy_helper.188 + 30329
58 UIKitCore 0x000000010c56e70e +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1394
59 UIKitCore 0x000000010d33fdb8 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1318
60 UIKitCore 0x000000010d340390 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 562
61 UIKitCore 0x000000010ccf17e0 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 350
62 FrontBoardServices 0x00007ff805445c8a -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 415
63 FrontBoardServices 0x00007ff805473deb __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.187 + 102
64 FrontBoardServices 0x00007ff805453cda -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209
65 FrontBoardServices 0x00007ff8054739e0 __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke + 344
66 libdispatch.dylib 0x000000010c268f5b _dispatch_client_callout + 8
67 libdispatch.dylib 0x000000010c26c8d2 _dispatch_block_invoke_direct + 496
68 FrontBoardServices 0x00007ff80549a6c0 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
69 FrontBoardServices 0x00007ff80549a5b6 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 174
70 FrontBoardServices 0x00007ff80549a6e8 -[FBSSerialQueue _performNextFromRunLoopSource] + 19
71 CoreFoundation 0x00007ff800386ebd __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
72 CoreFoundation 0x00007ff800386dfc __CFRunLoopDoSource0 + 157
73 CoreFoundation 0x00007ff800386659 __CFRunLoopDoSources0 + 308
74 CoreFoundation 0x00007ff800380db3 __CFRunLoopRun + 927
75 CoreFoundation 0x00007ff800380637 CFRunLoopRunSpecific + 560
76 GraphicsServices 0x00007ff809c0f28a GSEventRunModal + 139
77 UIKitCore 0x000000010d33e425 -[UIApplication _run] + 994
78 UIKitCore 0x000000010d343301 UIApplicationMain + 123
79 SwiftUI 0x0000000110dbcfa3 __swift_memcpy53_8 + 95801
80 SwiftUI 0x0000000110dbce50 __swift_memcpy53_8 + 95462
81 SwiftUI 0x00000001104dcafc __swift_memcpy195_8 + 12192
82 EducationApp 0x000000010bd0d05e $s12EducationApp0abB0V5$mainyyFZ + 30
83 EducationApp 0x000000010bd0d1b9 main + 9
84 dyld 0x000000010bf5d2bf start_sim + 10
85 ??? 0x000000011435252e 0x0 + 4633994542
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'currently unsupported (too many keypaths)'
terminating with uncaught exception of type NSException
CoreSimulator 857.7 - Device: iPhone 14 Pro (8DEDA7D0-7C9E-4AA0-9543-1745DE6286A8) - Runtime: iOS 16.0 (20A360) - DeviceType: iPhone 14 Pro
(lldb)

Resolved:
I went back and tried to determine if too many attributes was causing the problem. I deleted most of them and the code started working again, so I started adding them back in again. Now the code appears to be working correctly.

Related

SwiftUI crash Crashlytics reported

I am receiving a crash to Firebase Crashlytics:
Crashed: com.apple.main-thread
0 AttributeGraph 0x5004 AG::Graph::UpdateStack::update() + 224
1 AttributeGraph 0x5518 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 328
2 AttributeGraph 0xa718 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 360
3 AttributeGraph 0x1b3c0 AGGraphGetValue + 228
4 SwiftUI 0xa4fdc specialized DynamicBody.phase.getter + 28
5 SwiftUI 0xaada0 specialized DynamicBody.updateValue() + 56
6 SwiftUI 0x20f9c0 partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 40
7 AttributeGraph 0x5108 AG::Graph::UpdateStack::update() + 484
8 AttributeGraph 0x5518 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 328
9 AttributeGraph 0xa1a8 AG::Graph::value_ref(AG::AttributeID, AGSwiftMetadata const*, bool*) + 152
10 AttributeGraph 0x1b408 AGGraphGetValue + 300
11 SwiftUI 0x439378 ViewGraph.sizeThatFits(_:) + 212
12 SwiftUI 0x439194 ViewGraph.updateIdealSize() + 48
13 SwiftUI 0x438fc0 ViewGraph.updateOutputs(at:) + 108
14 SwiftUI 0x84eef4 closure #1 in ViewRendererHost.render(interval:updateDisplayList:) + 1332
15 SwiftUI 0x84ae68 ViewRendererHost.render(interval:updateDisplayList:) + 292
16 SwiftUI 0x3395a0 closure #1 in _UIHostingView.requestImmediateUpdate() + 68
17 SwiftUI 0x9a2190 thunk for #escaping #callee_guaranteed () -> () + 20
18 libdispatch.dylib 0x602b0 _dispatch_call_block_and_release + 24
19 libdispatch.dylib 0x61298 _dispatch_client_callout + 16
20 libdispatch.dylib 0x43430 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 872
21 CoreFoundation 0x9a998 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
22 CoreFoundation 0x94df8 __CFRunLoopRun + 2528
23 CoreFoundation 0x93ed0 CFRunLoopRunSpecific + 572
24 GraphicsServices 0x3570 GSEventRunModal + 160
25 UIKitCore 0xb302d0 -[UIApplication _run] + 1052
26 UIKitCore 0xb3584c UIApplicationMain + 164
27 SwiftUI 0x881530 closure #1 in KitRendererCommon(_:) + 108
28 SwiftUI 0x8814c0 runApp<A>(_:) + 176
29 SwiftUI 0x432870 static App.main() + 96
30 ShopmonkeyApp 0xf144 main + 4297568580 (<compiler-generated>:4297568580)
31 libdyld.dylib 0x1140 start + 4
But there is no specific place where it's crashing. Has anybody faced the same crash?

Catalyst app crashes when using WheelPickerStyle()

I have a Catalyst version of my app written on SwiftUI. There is a picker which I wanted to be styled as WheelPickerStyle(). Mac Catalyst supports WheelPickerStyle():
https://developer.apple.com/documentation/swiftui/wheelpickerstyle
At launch app crashes. With other styles everything works fine.
2021-05-20 11:04:48.341319+0300 Н или НН[2745:66389] [General] UIPickerView is not supported when running Catalyst apps in the Mac idiom.
2021-05-20 11:04:48.350037+0300 Н или НН[2745:66389] [General] (
0 CoreFoundation 0x00007fff205fd87b __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff20335d92 objc_exception_throw + 48
2 UIKitCore 0x00007fff4544dc52 -[UIView(UICatalystMacIdiomUnsupported_Internal) _throwForUnsupportedNonMacIdiomBehaviorWithReason:] + 0
3 UIKitCore 0x00007fff45158fe4 -[UIPickerView _didMoveFromWindow:toWindow:] + 191
4 UIKitCore 0x00007fff44578d14 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 759
5 UIKitCore 0x00007fff4452dfa1 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 130
6 UIKitCore 0x00007fff4452de1a -[UIView(Hierarchy) _postMovedFromSuperview:] + 800
7 UIKitCore 0x00007fff4452cbcd -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1957
8 SwiftUI 0x00007fff565f2e0b $s7SwiftUI11DisplayListV11ViewUpdaterC010updateItemE033_C85E9C9D8E8767197A33852BB19DA7BELL9container4from10localStateyAE9ContainerAGLLVz_AC0H0VAE5ModelO0U0VztF + 971
9 SwiftUI 0x00007fff565f2861 $s7SwiftUI11DisplayListV11ViewUpdaterC015updateInheritedE033_C85E9C9D8E8767197A33852BB19DA7BELL9container4from11parentStateyAE9ContainerAGLLVz_AC4ItemVSPyAE5ModelO0U0VGtF + 867
10 SwiftUI 0x00007fff565f2179 $s7SwiftUI11DisplayListV11ViewUpdaterC6update33_C85E9C9D8E8767197A33852BB19DA7BELL9container4from11parentStateyAE9ContainerAGLLVz_ACSPyAE5ModelO0T0VGtF + 513
11 SwiftUI 0x00007fff565f1e5f $s7SwiftUI11DisplayListV11ViewUpdaterC6render04rootE04from4time7version10maxVersion13contentsScaleAA4TimeVSo6UIViewC_AcnC0M0VAR12CoreGraphics7CGFloatVtFANSPyAE5ModelO5StateV7GlobalsVGXEfU_ + 314
12 SwiftUI 0x00007fff565f1ce8 $s7SwiftUI11DisplayListV11ViewUpdaterC6render04rootE04from4time7version10maxVersion13contentsScaleAA4TimeVSo6UIViewC_AcnC0M0VAR12CoreGraphics7CGFloatVtF + 670
13 SwiftUI 0x00007fff566ba9ee $s7SwiftUI11DisplayListV12ViewRendererC6render04rootE04from4time8nextTime7version10maxVersion13contentsScaleAA0L0VSo6UIViewC_Ac2oC0O0VAS12CoreGraphics7CGFloatVtF + 110
14 SwiftUI 0x00007fff56277796 $s7SwiftUI14_UIHostingViewC17renderDisplayList_4time8nextTime7version10maxVersionAA0J0VAA0fG0V_A2jL0M0VANtF + 230
15 SwiftUI 0x00007fff56832579 $s7SwiftUI16ViewRendererHostPAAE6render8interval17updateDisplayListySd_SbtFyyXEfU_ + 4674
16 SwiftUI 0x00007fff5682c3f2 $s7SwiftUI16ViewRendererHostPAAE6render8interval17updateDisplayListySd_SbtF + 350
17 SwiftUI 0x00007fff5699d5e2 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyF + 241
18 SwiftUI 0x00007fff5699d600 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyFTo + 21
19 UIKitCore 0x00007fff44580013 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2925
20 QuartzCore 0x00007fff26d058d3 -[CALayer layoutSublayers] + 326
21 QuartzCore 0x00007fff26d05239 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 619
22 QuartzCore 0x00007fff26e5107f _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 655
23 QuartzCore 0x00007fff26ce70df _ZN2CA11Transaction6commitEv + 713
24 UIKitCore 0x00007fff44661e14 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 81
25 CoreFoundation 0x00007fff20583512 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
26 CoreFoundation 0x00007fff205833c3 __CFRunLoopDoBlocks + 440
27 CoreFoundation 0x00007fff2058209d __CFRunLoopRun + 910
28 CoreFoundation 0x00007fff2058164c CFRunLoopRunSpecific + 563
29 HIToolbox 0x00007fff287bfab3 RunCurrentEventLoopInMode + 292
30 HIToolbox 0x00007fff287bf815 ReceiveNextEventCommon + 587
31 HIToolbox 0x00007fff287bf5b3 _BlockUntilNextEventMatchingListInModeWithFilter + 70
32 AppKit 0x00007fff22d826f2 _DPSNextEvent + 864
33 AppKit 0x00007fff22d80ec5 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1364
34 AppKit 0x00007fff22d73239 -[NSApplication run] + 586
35 AppKit 0x00007fff22d4747c NSApplicationMain + 816
36 AppKit 0x00007fff2303e414 _NSApplicationMainWithInfoDictionary + 16
37 UIKitMacHelper 0x00007fff3405ed47 UINSApplicationMain + 1430
38 UIKitCore 0x00007fff444cc98c UIApplicationMain + 144
39 –Э –Є–ї–Є –Э–Э 0x00000001088fee4b main + 75
40 libdyld.dylib 0x00007fff204a5f5d start + 1
41 ??? 0x0000000000000003 0x0 + 3
)
(lldb)

SwiftUI crash AttributeGraph precondition failure: invalid attribute id: 83753

I got this (not particularly helpful, in my eyes) crash message and was wondered what the usual suspect was for this/where I'm best to look? I'm getting this when I navigate using a NavigationLink to another View. I know from some research that this crash tends to have a different cause each time, but I wondered if the stack trace would give any clues?
Each crash companies about the same invalid attribute id: 83753. Any way I can track something down using this ID?
Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x1c1f2584c __pthread_kill + 8
1 libsystem_pthread.dylib 0x1de7f09e8 pthread_kill + 212
2 libsystem_c.dylib 0x19ed5c8f4 abort + 100
3 AttributeGraph 0x1bd82dc7c util::Heap::Heap(void*, unsigned long, unsigned long) + 186
4 AttributeGraph 0x1bd8269f0 AG::AttributeID::size() const + 238
5 AttributeGraph 0x1bd82d530 AGGraphGetValue + 500
6 SwiftUI 0x19c9e4eb0 ResolvedTextFilter.updateValue() + 56
7 SwiftUI 0x19c4cee34 partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 20
8 AttributeGraph 0x1bd81714c AG::Graph::UpdateStack::update() + 484
9 AttributeGraph 0x1bd81755c AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 328
10 AttributeGraph 0x1bd81c1f8 AG::Graph::value_ref(AG::AttributeID, AGSwiftMetadata const*, bool*) + 152
11 AttributeGraph 0x1bd82d468 AGGraphGetValue + 300
12 SwiftUI 0x19c6321d8 ViewGraph.sizeThatFits(_:) + 212
13 SwiftUI 0x19ca285e0 closure #1 in ViewRendererHost.sizeThatFits(_:) + 52
14 SwiftUI 0x19c5d2ec4 thunk for #callee_guaranteed (#guaranteed ViewGraph) -> (#unowned CGSize) + 24
15 SwiftUI 0x19ca2687c closure #1 in ViewRendererHost.updateViewGraph<A>(body:) + 92
16 SwiftUI 0x19ca1f0b4 ViewRendererHost.updateViewGraph<A>(body:) + 88
17 SwiftUI 0x19ca25328 ViewRendererHost.sizeThatFits(_:) + 112
18 SwiftUI 0x19cb7b980 _UIHostingView.sizeThatFits(_:) + 112
19 SwiftUI 0x19cb7b9c8 #objc _UIHostingView._baselineOffsets(at:) + 48
20 UIKitCore 0x197eadbb0 -[_UITAMICAdaptorView updateForAvailableSize] + 120
21 UIKitCore 0x197eadafc -[_UITAMICAdaptorView didMoveToWindow] + 60
22 UIKitCore 0x198dcdbc0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 2016
23 UIKitCore 0x198dcd680 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 672
24 UIKitCore 0x198dcd680 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 672
25 UIKitCore 0x197ed2350 -[UINavigationBar _didMoveFromWindow:toWindow:] + 64
26 UIKitCore 0x198dc1ac8 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 136
27 UIKitCore 0x198dc19b4 -[UIView(Hierarchy) _postMovedFromSuperview:] + 748
28 UIKitCore 0x198dd0028 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 2132
29 UIKitCore 0x1981385d8 -[UILayoutContainerView addSubview:] + 64
30 UIKitCore 0x1981434a0 -[UINavigationController _unhideNavigationBarForEdge:] + 100
31 UIKitCore 0x1981436e8 -[UINavigationController _setNavigationBarHidden:edge:duration:] + 216
32 UIKitCore 0x198142d30 -[UINavigationController _setNavigationBarHidden:edgeIfNotNavigating:duration:] + 516
33 UIKitCore 0x1981416ac -[UINavigationController setNavigationBarHidden:animated:] + 156
34 SwiftUI 0x19cadace8 NavigationBridge_PhoneTV.hostingControllerWillAppear(transitionCoordinator:animated:) + 876
35 SwiftUI 0x19c53fc60 _UIHostingView.viewControllerWillAppear(transitionCoordinator:animated:) + 48
36 SwiftUI 0x19cb7fd20 UIHostingController.viewWillAppear(_:) + 116
37 SwiftUI 0x19cb7fc3c #objc UIHostingController.viewWillAppear(_:) + 40
38 UIKitCore 0x198210a4c -[UIViewController _setViewAppearState:isAnimating:] + 604
39 UIKitCore 0x1982111d0 -[UIViewController __viewWillAppear:] + 116
40 UIKitCore 0x19813f7e8 -[UINavigationController _startCustomTransition:] + 1344
41 UIKitCore 0x198153bb0 -[UINavigationController _startDeferredTransitionIfNeeded:] + 700
42 UIKitCore 0x198154fe0 -[UINavigationController __viewWillLayoutSubviews] + 164
43 UIKitCore 0x198137e78 -[UILayoutContainerView layoutSubviews] + 224
44 UIKitCore 0x198dd6398 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2468
45 QuartzCore 0x1992dbdf4 -[CALayer layoutSublayers] + 288
46 QuartzCore 0x1992e2398 CA::Layer::layout_if_needed(CA::Transaction*) + 520
47 QuartzCore 0x1992ed6e8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 140
48 QuartzCore 0x199238d7c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 416
49 QuartzCore 0x199262f40 CA::Transaction::commit() + 728
50 QuartzCore 0x1992641f0 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
51 CoreFoundation 0x195fe087c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
52 CoreFoundation 0x195fdaf50 __CFRunLoopDoObservers + 604
53 CoreFoundation 0x195fdb498 __CFRunLoopRun + 960
54 CoreFoundation 0x195fdaba0 CFRunLoopRunSpecific + 572
55 GraphicsServices 0x1acd43598 GSEventRunModal + 160
56 UIKitCore 0x1988cc2f4 -[UIApplication _run] + 1052
57 UIKitCore 0x1988d1874 UIApplicationMain + 164
58 SwiftUI 0x19ca5a5dc closure #1 in KitRendererCommon(_:) + 108
59 SwiftUI 0x19ca5a56c runApp<A>(_:) + 176
60 SwiftUI 0x19c62bd18 static App.main() + 96
61 ProgressioniOS 0x10077f06c static ProgressionApp.$main() (<compiler-generated>)
62 ProgressioniOS 0x10077f39c main (ProgressionApp.swift)
63 libdyld.dylib 0x195cb9568 start + 4
Any thoughts appreciated.

Swift 3 "Thread 1: signal SIGABRT" error

I am getting this aforementioned error. I've applied the following solution from this thread and that one with no avail. Is there some module or class I'm suppose to import? Any help will be appreciated.
Github: https://github.com/joeavargas/BMI-Calc/tree/master/BMI%20Calc
Swift 3 / Xcode 8.3.3
error
Error from Console:
2017-07-06 08:20:28.252 BMI Calc[61662:12276419] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key mass.'
* First throw call stack:
(
0 CoreFoundation 0x000000010df6eb0b exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010b2fe141 objc_exception_throw + 48
2 CoreFoundation 0x000000010df6ea59 -[NSException raise] + 9
3 Foundation 0x000000010ae1400b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
4 UIKit 0x000000010b96b994 -[UIViewController setValue:forKey:] + 87
5 UIKit 0x000000010bbd8a09 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000010df14e8d -[NSArray makeObjectsPerformSelector:] + 269
7 UIKit 0x000000010bbd73bf -[UINib instantiateWithOwner:options:] + 1856
8 UIKit 0x000000010b971fc3 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
9 UIKit 0x000000010b9728d9 -[UIViewController loadView] + 177
10 UIKit 0x000000010b972c0a -[UIViewController loadViewIfRequired] + 195
11 UIKit 0x000000010b97345a -[UIViewController view] + 27
12 UIKit 0x000000010b83b98a -[UIWindow addRootViewControllerViewIfPossible] + 65
13 UIKit 0x000000010b83c070 -[UIWindow _setHidden:forced:] + 294
14 UIKit 0x000000010b84eebe -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x000000010b7c837f -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4346
16 UIKit 0x000000010b7ce5e4 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1709
17 UIKit 0x000000010b7cb7f3 -[UIApplication workspaceDidEndTransaction:] + 182
18 FrontBoardServices 0x000000010f67e5f6 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24
19 FrontBoardServices 0x000000010f67e46d -[FBSSerialQueue _performNext] + 186
20 FrontBoardServices 0x000000010f67e7f6 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
21 CoreFoundation 0x000000010df14c01 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
22 CoreFoundation 0x000000010defa0cf __CFRunLoopDoSources0 + 527
23 CoreFoundation 0x000000010def95ff __CFRunLoopRun + 911
24 CoreFoundation 0x000000010def9016 CFRunLoopRunSpecific + 406
25 UIKit 0x000000010b7ca08f -[UIApplication _run] + 468
26 UIKit 0x000000010b7d0134 UIApplicationMain + 159
27 BMI Calc 0x000000010ad246f7 main + 55
28 libdyld.dylib 0x000000010ef0e65d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
The most significant information is
this class is not key value coding-compliant for the key mass.
Select the storyboard or xib file in the project navigator
Select the view controller
Open Connection Inspector (⌥⌘6)
Remove the connection to mass

Unit Tests for Core Data Stack with In-Memory Store Keep Failing

I am building a personal project to allow my wife and I to monitor our grocery spending habits. The application utilizes Core Data, and I am having difficulty with my unit tests. I am testing my CoreDataStack class to ensure that its methods are saving and deleting objects.
Here is CoreDataStack:
internal class CoreDataStack {
// MARK: - Properties
private let modelName: String
internal lazy var storeContainer: NSPersistentContainer = {
let container = NSPersistentContainer(name: self.modelName)
container.loadPersistentStores { (storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
}
return container
}()
internal lazy var managedContext: NSManagedObjectContext = {
return self.storeContainer.viewContext
}()
// MARK: - Initialization
internal init(modelName: String = "Cart") {
self.modelName = modelName
}
// MARK: - Saving
internal func saveContext() {
guard managedContext.hasChanges else {
return
}
do {
try managedContext.save()
} catch let error as NSError {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
}
// MARK: - Deleting
internal func delete(object: NSManagedObject, from context: NSManagedObjectContext) {
context.delete(object)
}
internal func delete(allObjectsForEntity entity: String, from context: NSManagedObjectContext) {
let deleteFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: entity)
let batchDeleteRequest = NSBatchDeleteRequest(fetchRequest: deleteFetchRequest)
do {
try storeContainer.persistentStoreCoordinator.execute(batchDeleteRequest, with: context)
} catch let error as NSError {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
}
}
I have created a subclass of CoreDataStack, called TestCoreDataStack, in my tests target. TestCoreDataStack uses an in-memory store so that it is destroyed when the encompassing test is finished.
Here is TestCoreDataStack:
internal final class TestCoreDataStack: CoreDataStack {
// MARK: - Initialization
internal override init(modelName: String = "Cart") {
super.init(modelName: modelName)
let persistentStoreDescription = NSPersistentStoreDescription()
persistentStoreDescription.type = NSInMemoryStoreType
let container = NSPersistentContainer(name: modelName)
container.persistentStoreDescriptions = [persistentStoreDescription]
container.loadPersistentStores { (storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
}
self.storeContainer = container
}
}
I also have a helper class, ManagedObjectFetcher, which is included only in my tests target, simply for fetching managed objects after they are saved or deleted. This class is used so that I can verify the counts and that the correct information exists after objects have been saved or deleted.
Hers is ManagedObjectFetcher:
internal final class ManagedObjectFetcher {
// MARK: - Properties
private let coreDataStack: CoreDataStack
// MARK: - Initialization
internal init(coreDataStack: CoreDataStack) {
self.coreDataStack = coreDataStack
}
// MARK: - All Records
internal func allRecords<T: NSManagedObject>(for entity : T.Type) -> [T] {
let request = T.fetchRequest()
do {
guard let results = try coreDataStack.managedContext.fetch(request) as? [T] else {
fatalError("Invalid results")
}
return results
} catch {
fatalError("Error with request: \(error)")
}
}
}
CoreDataStackTests is my XCTestCase subclass for testing CoreDataStack to ensure that objects are saved or deleted.
Here is CoreDataStackTests:
internal final class CoreDataStackTests: XCTestCase {
// MARK: - Properties
private var coreDataStack: TestCoreDataStack!
private var managedObjectFetcher: ManagedObjectFetcher!
// MARK: - Test Lifecycle
override func setUp() {
super.setUp()
coreDataStack = TestCoreDataStack()
managedObjectFetcher = ManagedObjectFetcher(coreDataStack: coreDataStack)
}
override func tearDown() {
coreDataStack = nil
managedObjectFetcher = nil
super.tearDown()
}
// MARK: - Saving
// Test 1
internal func test_CoreDataStack_Saves_GroceryItem() {
let preResults = managedObjectFetcher.allRecords(for: GroceryItem.self)
XCTAssertEqual(preResults.count, 0, "Expected `0`")
let _ = GroceryItem(name: "Name", singleItemPrice: Decimal(0.99), quantity: 1, date: Date(), isTaxable: true, managedObjectContext: coreDataStack.managedContext)
coreDataStack.saveContext()
let postResults = managedObjectFetcher.allRecords(for: GroceryItem.self)
XCTAssertEqual(postResults.count, 1, "Expected `1`")
}
// MARK: - Deleting
// Test 2
internal func test_CoreDataStack_Deletes_GroceryItem() {
let initialResults = managedObjectFetcher.allRecords(for: GroceryItem.self)
XCTAssertEqual(initialResults.count, 0, "Expected `0`")
let item = GroceryItem(name: "Name", singleItemPrice: Decimal(0.99), quantity: 1, date: Date(), isTaxable: true, managedObjectContext: coreDataStack.managedContext)
coreDataStack.saveContext()
let preResults = managedObjectFetcher.allRecords(for: GroceryItem.self)
XCTAssertEqual(preResults.count, 1, "Expected `1`")
coreDataStack.delete(object: item, from: coreDataStack.managedContext)
coreDataStack.saveContext()
let postResults = managedObjectFetcher.allRecords(for: GroceryItem.self)
XCTAssertEqual(postResults.count, 0, "Expected `0`")
}
// Test 3
internal func test_CoreDataStack_Deletes_AllGroceryItems() {
let initialResults = managedObjectFetcher.allRecords(for: GroceryItem.self)
XCTAssertEqual(initialResults.count, 0, "Expected `0`")
let _ = GroceryItem(name: "Name", singleItemPrice: Decimal(0.99), quantity: 1, date: Date(), isTaxable: true, managedObjectContext: coreDataStack.managedContext)
let _ = GroceryItem(name: "Another Name", singleItemPrice: Decimal(5.99), quantity: 2, date: Date(), isTaxable: false, managedObjectContext: coreDataStack.managedContext)
coreDataStack.saveContext()
let preResults = managedObjectFetcher.allRecords(for: GroceryItem.self)
XCTAssertEqual(preResults.count, 2, "Expected `2`")
coreDataStack.delete(allObjectsForEntity: GroceryItem.description(), from: coreDataStack.managedContext)
coreDataStack.saveContext()
let postResults = managedObjectFetcher.allRecords(for: GroceryItem.self)
XCTAssertEqual(postResults.count, 0, "Expected `0`")
}
}
When executing the tests in CoreDataStackTests, I run into the following issues that I can't resolve:
Test 1: The test passes when ran alone. When all tests of CoreDataStack tests are ran, it passes or fails.
Test 2: The test passes when ran alone. When all tests of CoreDataStack tests are ran, it passes or fails.
Test 3: The test never passes whether it has ran alone or with the other tests. A Test Failure Breakpoint gets hit at try storeContainer.persistentStoreCoordinator.execute(batchDeleteRequest, with: context) inside the delete(allObjectsForEntity entity: String, from context: NSManagedObjectContext) method of CoreDataStack with each run.
This is the console output that I get after running all three tests:
Test Suite 'Selected tests' started at 2017-07-03 21:24:01.609
Test Suite 'CartTests.xctest' started at 2017-07-03 21:24:01.610
Test Suite 'CoreDataStackTests' started at 2017-07-03 21:24:01.610
Test Case '-[CartTests.CoreDataStackTests test_CoreDataStack_Deletes_AllGroceryItems]' started.
<unknown>:0: error: -[CartTests.CoreDataStackTests test_CoreDataStack_Deletes_AllGroceryItems] : failed: caught "NSInternalInconsistencyException", "Unknown command type <NSBatchDeleteRequest : resultType : 0, fetch :<NSFetchRequest: 0x6000000de450> (entity: GroceryItem; predicate: ((null)); sortDescriptors: ((null)); type: NSManagedObjectIDResultType; includesPropertyValues: NO; includesPendingChanges: NO; ) >"
(
0 CoreFoundation 0x000000010c90079b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010bd2e121 objc_exception_throw + 48
2 CoreData 0x000000010c34febf -[NSMappedObjectStore executeRequest:withContext:error:] + 303
3 CoreData 0x000000010c3f0f6d __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke + 2509
4 CoreData 0x000000010c3e9126 __55-[NSPersistentStoreCoordinator _routeHeavyweightBlock:]_block_invoke + 86
5 CoreData 0x000000010c3fcda9 gutsOfBlockToNSPersistentStoreCoordinatorPerform + 185
6 libdispatch.dylib 0x0000000110bfbbb9 _dispatch_client_callout + 8
7 libdispatch.dylib 0x0000000110c02500 _dispatch_queue_barrier_sync_invoke_and_complete + 92
8 CoreData 0x000000010c3e8ab5 _perform + 213
9 CoreData 0x000000010c3e8e3b -[NSPersistentStoreCoordinator _routeHeavyweightBlock:] + 283
10 CoreData 0x000000010c2f2aba -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 634
11 Cart 0x000000010b40b667 _T04Cart13CoreDataStackC16deleteAllObjectsySS9forEntity_So22NSManagedObjectContextC4fromtF + 391
12 CartTests 0x00000001240ea070 _T09CartTests013CoreDataStackB0C05test_cdE24_Deletes_AllGroceryItemsyyF + 3344
13 CartTests 0x00000001240eabc4 _T09CartTests013CoreDataStackB0C05test_cdE24_Deletes_AllGroceryItemsyyFTo + 36
14 CoreFoundation 0x000000010c884f8c __invoking___ + 140
15 CoreFoundation 0x000000010c884e60 -[NSInvocation invoke] + 320
16 XCTest 0x00000001224dd6e0 __24-[XCTestCase invokeTest]_block_invoke_2 + 451
17 XCTest 0x0000000122524bed -[XCUITestContext performInScope:] + 187
18 XCTest 0x00000001224dd4f8 -[XCTestCase invokeTest] + 254
19 XCTest 0x00000001224de424 __26-[XCTestCase performTest:]_block_invoke.362 + 42
20 XCTest 0x0000000122529432 +[XCTContext runInContextForTestCase:block:] + 163
21 XCTest 0x00000001224dddc0 -[XCTestCase performTest:] + 608
22 XCTest 0x00000001224da396 __27-[XCTestSuite performTest:]_block_invoke + 295
23 XCTest 0x00000001224d9f8d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 26
24 XCTest 0x00000001224da171 -[XCTestSuite performTest:] + 214
25 XCTest 0x00000001224da396 __27-[XCTestSuite performTest:]_block_invoke + 295
26 XCTest 0x00000001224d9f8d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 26
27 XCTest 0x00000001224da171 -[XCTestSuite performTest:] + 214
28 XCTest 0x00000001224da396 __27-[XCTestSuite performTest:]_block_invoke + 295
29 XCTest 0x00000001224d9f8d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 26
30 XCTest 0x00000001224da171 -[XCTestSuite performTest:] + 214
31 XCTest 0x0000000122530625 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 40
32 XCTest 0x00000001224ecb99 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 480
33 XCTest 0x00000001225304c4 -[XCTTestRunSession runTestsAndReturnError:] + 281
34 XCTest 0x00000001224c9d43 -[XCTestDriver runTestsAndReturnError:] + 254
35 XCTest 0x00000001225286b7 _XCTestMain + 616
36 CoreFoundation 0x000000010c8a3dcc __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
37 CoreFoundation 0x000000010c88833b __CFRunLoopDoBlocks + 203
38 CoreFoundation 0x000000010c887b34 __CFRunLoopRun + 1060
39 CoreFoundation 0x000000010c887499 CFRunLoopRunSpecific + 409
40 GraphicsServices 0x00000001121d79d7 GSEventRunModal + 62
41 UIKit 0x000000010cd7f0b8 UIApplicationMain + 159
42 Cart 0x000000010b40e637 main + 55
43 libdyld.dylib 0x0000000110c71771 start + 1
44 ??? 0x0000000000000005 0x0 + 5
)
Test Case '-[CartTests.CoreDataStackTests test_CoreDataStack_Deletes_AllGroceryItems]' failed (2636.006 seconds).
Test Case '-[CartTests.CoreDataStackTests test_CoreDataStack_Deletes_GroceryItem]' started.
<unknown>:0: error: -[CartTests.CoreDataStackTests test_CoreDataStack_Deletes_GroceryItem] : failed: caught "NSInvalidArgumentException", "executeFetchRequest:error: <null> is not a valid NSFetchRequest."
(
0 CoreFoundation 0x000000010c90079b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010bd2e121 objc_exception_throw + 48
2 CoreData 0x000000010c2f11d8 -[NSManagedObjectContext executeFetchRequest:error:] + 792
3 CartTests 0x00000001240eb1f7 _T09CartTests20ManagedObjectFetcherC10allRecordsSayxGxm3for_tSo09NSManagedD0CRbzlF + 247
4 CartTests 0x00000001240e7d86 _T09CartTests013CoreDataStackB0C05test_cdE20_Deletes_GroceryItemyyF + 182
5 CartTests 0x00000001240e9344 _T09CartTests013CoreDataStackB0C05test_cdE20_Deletes_GroceryItemyyFTo + 36
6 CoreFoundation 0x000000010c884f8c __invoking___ + 140
7 CoreFoundation 0x000000010c884e60 -[NSInvocation invoke] + 320
8 XCTest 0x00000001224dd6e0 __24-[XCTestCase invokeTest]_block_invoke_2 + 451
9 XCTest 0x0000000122524bed -[XCUITestContext performInScope:] + 187
10 XCTest 0x00000001224dd4f8 -[XCTestCase invokeTest] + 254
11 XCTest 0x00000001224de424 __26-[XCTestCase performTest:]_block_invoke.362 + 42
12 XCTest 0x0000000122529432 +[XCTContext runInContextForTestCase:block:] + 163
13 XCTest 0x00000001224dddc0 -[XCTestCase performTest:] + 608
14 XCTest 0x00000001224da396 __27-[XCTestSuite performTest:]_block_invoke + 295
15 XCTest 0x00000001224d9f8d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 26
16 XCTest 0x00000001224da171 -[XCTestSuite performTest:] + 214
17 XCTest 0x00000001224da396 __27-[XCTestSuite performTest:]_block_invoke + 295
18 XCTest 0x00000001224d9f8d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 26
19 XCTest 0x00000001224da171 -[XCTestSuite performTest:] + 214
20 XCTest 0x00000001224da396 __27-[XCTestSuite performTest:]_block_invoke + 295
21 XCTest 0x00000001224d9f8d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 26
22 XCTest 0x00000001224da171 -[XCTestSuite performTest:] + 214
23 XCTest 0x0000000122530625 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 40
24 XCTest 0x00000001224ecb99 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 480
25 XCTest 0x00000001225304c4 -[XCTTestRunSession runTestsAndReturnError:] + 281
26 XCTest 0x00000001224c9d43 -[XCTestDriver runTestsAndReturnError:] + 254
27 XCTest 0x00000001225286b7 _XCTestMain + 616
28 CoreFoundation 0x000000010c8a3dcc __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
29 CoreFoundation 0x000000010c88833b __CFRunLoopDoBlocks + 203
30 CoreFoundation 0x000000010c887b34 __CFRunLoopRun + 1060
31 CoreFoundation 0x000000010c887499 CFRunLoopRunSpecific + 409
32 GraphicsServices 0x00000001121d79d7 GSEventRunModal + 62
33 UIKit 0x000000010cd7f0b8 UIApplicationMain + 159
34 Cart 0x000000010b40e637 main + 55
35 libdyld.dylib 0x0000000110c71771 start + 1
36 ??? 0x0000000000000005 0x0 + 5
)
Test Case '-[CartTests.CoreDataStackTests test_CoreDataStack_Deletes_GroceryItem]' failed (11.969 seconds).
Test Case '-[CartTests.CoreDataStackTests test_CoreDataStack_Saves_GroceryItem]' started.
<unknown>:0: error: -[CartTests.CoreDataStackTests test_CoreDataStack_Saves_GroceryItem] : failed: caught "NSInvalidArgumentException", "executeFetchRequest:error: <null> is not a valid NSFetchRequest."
(
0 CoreFoundation 0x000000010c90079b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010bd2e121 objc_exception_throw + 48
2 CoreData 0x000000010c2f11d8 -[NSManagedObjectContext executeFetchRequest:error:] + 792
3 CartTests 0x00000001240eb1f7 _T09CartTests20ManagedObjectFetcherC10allRecordsSayxGxm3for_tSo09NSManagedD0CRbzlF + 247
4 CartTests 0x00000001240e6fe6 _T09CartTests013CoreDataStackB0C05test_cdE18_Saves_GroceryItemyyF + 182
5 CartTests 0x00000001240e7cb4 _T09CartTests013CoreDataStackB0C05test_cdE18_Saves_GroceryItemyyFTo + 36
6 CoreFoundation 0x000000010c884f8c __invoking___ + 140
7 CoreFoundation 0x000000010c884e60 -[NSInvocation invoke] + 320
8 XCTest 0x00000001224dd6e0 __24-[XCTestCase invokeTest]_block_invoke_2 + 451
9 XCTest 0x0000000122524bed -[XCUITestContext performInScope:] + 187
10 XCTest 0x00000001224dd4f8 -[XCTestCase invokeTest] + 254
11 XCTest 0x00000001224de424 __26-[XCTestCase performTest:]_block_invoke.362 + 42
12 XCTest 0x0000000122529432 +[XCTContext runInContextForTestCase:block:] + 163
13 XCTest 0x00000001224dddc0 -[XCTestCase performTest:] + 608
14 XCTest 0x00000001224da396 __27-[XCTestSuite performTest:]_block_invoke + 295
15 XCTest 0x00000001224d9f8d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 26
16 XCTest 0x00000001224da171 -[XCTestSuite performTest:] + 214
17 XCTest 0x00000001224da396 __27-[XCTestSuite performTest:]_block_invoke + 295
18 XCTest 0x00000001224d9f8d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 26
19 XCTest 0x00000001224da171 -[XCTestSuite performTest:] + 214
20 XCTest 0x00000001224da396 __27-[XCTestSuite performTest:]_block_invoke + 295
21 XCTest 0x00000001224d9f8d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 26
22 XCTest 0x00000001224da171 -[XCTestSuite performTest:] + 214
23 XCTest 0x0000000122530625 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 40
24 XCTest 0x00000001224ecb99 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 480
25 XCTest 0x00000001225304c4 -[XCTTestRunSession runTestsAndReturnError:] + 281
26 XCTest 0x00000001224c9d43 -[XCTestDriver runTestsAndReturnError:] + 254
27 XCTest 0x00000001225286b7 _XCTestMain + 616
28 CoreFoundation 0x000000010c8a3dcc __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
29 CoreFoundation 0x000000010c88833b __CFRunLoopDoBlocks + 203
30 CoreFoundation 0x000000010c887b34 __CFRunLoopRun + 1060
31 CoreFoundation 0x000000010c887499 CFRunLoopRunSpecific + 409
32 GraphicsServices 0x00000001121d79d7 GSEventRunModal + 62
33 UIKit 0x000000010cd7f0b8 UIApplicationMain + 159
34 Cart 0x000000010b40e637 main + 55
35 libdyld.dylib 0x0000000110c71771 start + 1
36 ??? 0x0000000000000005 0x0 + 5
)
Test Case '-[CartTests.CoreDataStackTests test_CoreDataStack_Saves_GroceryItem]' failed (4.826 seconds).
Test Suite 'CoreDataStackTests' failed at 2017-07-03 22:08:14.412.
Executed 3 tests, with 3 failures (3 unexpected) in 2652.801 (2652.802) seconds
Test Suite 'CartTests.xctest' failed at 2017-07-03 22:08:14.413.
Executed 3 tests, with 3 failures (3 unexpected) in 2652.801 (2652.803) seconds
Test Suite 'Selected tests' failed at 2017-07-03 22:08:14.413.
Executed 3 tests, with 3 failures (3 unexpected) in 2652.801 (2652.804) seconds
Test session log:
/var/folders/n9/48n8p_ms6rs2yc8vdkhq89br0000gn/T/com.apple.dt.XCTest/IDETestRunSession-44B21AFF-A887-42A9-8EF0-23B48DBC4744/CartTests-4BFEF3B5-D9B6-47D9-BA80-6007A7991D19/Session-CartTests-2017-07-03_212349-pZbWPl.log
What am I doing incorrectly that is causing these tests to fail?
Unfortunately, batch deletes are not supported with CoreData in-memory stores:
Important: Batch deletes are only available when you are using a SQLite persistent store.