Core Data

RSS for tag

Save your application’s permanent data for offline use, cache temporary data, and add undo functionality to your app on a single device using Core Data.

Posts under Core Data tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Migrate persistent store from CD to CD+CK
I have an app Im moving over to cloudkit and it works fine on a new instance, but updating to this instance causes a perpetual crash and requires reinstall. I know this is because the persistence object changed. I was just using a normal NSPersistentController now a CK one, and there are two persistent stores, the public and private stores. Is there a way to either migrate the data properly, or atleast wipe the data model before it crashes and have it start anew? (I dont have many users and I know them personally so this would be acceptable)
0
0
304
Aug ’23
(CoreData) Using UndoManger on a private Managed Object Context
I am having trouble using UndoManager with a private Manged Object Context in CoreData. Here is my setup: I have my main context running on the main queue. I created a private context via let privateContext = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType) and connect it as a child context to my main context via privateContext.parent = mainContext. I also assigned an UndoManager to privateContext. This UndoManger has been set to use manual grouping via undoManager.groupsByEvent = false. So far so good. Now to the part that gives me trouble: I want to change something on the private context and record this action for potential undoing. In order to do this a use a nested grouping structure (that is how it makes sense in my code). This is how i currently do this: privateContext.performAndWait { undoManger.beginUndoGrouping } // do something in code unrelated to changes on the privateContext privateContext.performAndWait { doChangesOnPrivateContext() } privateContext.performAndWait { undoManger.beginUndoGrouping } privateContext.performAndWait { doChangesOnPrivateContext() } privateContext.performAndWait { undoManger.endUndoGrouping } // do something in code unrelated to changes on the privateContext privateContext.performAndWait { undoManger.endUndoGrouping } This leads to the error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '_setGroupIdentifier:: NSUndoManager is in invalid state, must begin a group before registering undo which I had encountered before when beginUndoGrouping and endUndoGrouping were called from different threads. Further examination yields that this is also the case here as performAndWait runs the code on the private queue assigned to privateContext, but with the structure shown above beginUndoGrouping and endUndoGrouping are indeed called on different threads. So here are my questions: How do I do this correctly? Do I misunderstand things and UndoMangager should not be used on a private context? If so, how would I setup things then?
0
0
321
Aug ’23
Array Not Updating in ViewModel Despite Subscription
I'm facing an issue in my iOS app's architecture involving CoreData, the HistoryCallDataService class, and the HistoryViewModel. I'm hoping someone can help shed light on the problem I'm encountering. Problem Description: I'm working with CoreData and have an array that I'm managing through the HistoryCallDataService class. class HistoryCallDataService { private let container: NSPersistentContainer private let containerName = "CallHistoryData" private let entityName = "HistoryData" @Published var savedEntities: [HistoryData] = [] I'm observing changes in the savedEntities property of the HistoryCallDataService class using the historyDataService.$savedEntities publisher. When the app starts, the array is updated correctly. However, if I add new content, the savedEntities array updates, but the historyArray in the HistoryViewModel does not reflect these changes. import Foundation import Combine class HistoryViewModel: ObservableObject { @Published var searchText:String = "" @Published var historyArray: [HistoryData] = [] private let historyDataService = HistoryCallDataService() private var cancellables = Set<AnyCancellable>() var selectedContact: HistoryData? = nil @Published var filteredContacts: [HistoryData] = [] init(){ addSubscribers() } func addSubscribers(){ historyDataService.$savedEntities .debounce(for: 1.0, scheduler: RunLoop.main) .sink { [weak self] (returnData) in guard let self = self else { return } self.historyArray = returnData self.updateFilteredContacts() } .store(in: &cancellables) } func updateFilteredContacts() { if searchText.isEmpty { filteredContacts = historyArray } else { filteredContacts = historyArray.filter { contact in contact.firstName?.localizedCaseInsensitiveContains(searchText) ?? false || contact.lastName?.localizedCaseInsensitiveContains(searchText) ?? false || contact.telephone?.localizedCaseInsensitiveContains(searchText) ?? false } } } The view: private var contactList: some View{ List{ ForEach(vm.filteredContacts) { item in HStack{ VStack(alignment: .leading){ Text("\(item.firstName ?? "N/A") \(item.lastName ?? "N/A" )") .fontWeight(.semibold) Text("\(item.telephone ?? "N/A")") .fontWeight(.medium) .padding(.top,1) } Spacer() VStack(alignment: .trailing){ Text("\(item.time ?? "N/A")") .fontWeight(.medium) Text("\(item.callHidden ? "Hidden" : "Normally ")") .foregroundColor(item.callHidden ? Color.theme.red : Color.theme.black) .fontWeight(.bold) .padding(.top,1) } } .onTapGesture { vm.selectedContact = item showingCallAlert.toggle() } .listRowBackground(vm.selectedContact?.telephone == item.telephone && showingCallAlert ? Color.theme.gray : nil) } .onDelete(perform: { indexSet in for index in indexSet { let contactToDelete = vm.filteredContacts[index] vm.delete(entity: contactToDelete) } }) } .onChange(of: vm.searchText) { _ in vm.updateFilteredContacts() } .onChange(of: scenePhase) { newPhase in if newPhase == .active { print("Active") vm.updateFilteredContacts() } } .lineLimit(1) .listStyle(.plain) } If anyone has encountered a similar situation or has insights into what might be causing this behavior, I would greatly appreciate your guidance. Thank you in advance for your help!
3
0
555
Aug ’23
Cloudkit Many to Many relationship not updating on public record with full permissions when updated by user other than creator
I have narrowed my problem down to the many to many relationship between user and group record types. When a user transfers ownership of a group the new admin can change things like privacy (a field) but still only the original owner can leave or remove others. The new admin's use of remove user does nothing and no users can leave besides the creator. All security perms are enabled, and no permission not granted errors arise. I simply end up with two unsynced devices where one user observes themselves as having left, and the other that never will observe it. I can get around this a long way but don't really see why I should have to.
0
0
349
Aug ’23
How to get @FetchRequest respect fetchLimit when new records are added
How can I keep the fetchLimit constant even when new data is inserted? To replicate this, you can create a new Project in Xcode and check "Use Core Data". I use this code to apply fetchLimit: struct MyView: View { @FetchRequest private var items: FetchedResults<Item> init() { let request: NSFetchRequest<Item> = Item.fetchRequest() request.fetchLimit = 3 _items = FetchRequest(fetchRequest: request) } This code works. For example I have 10 Items and when I open the app - only 3 are displayed! But when I add a new Item on the fly - @FetchRequest just adds it to the View and now it displays 4 Items!? How can I make @FetchRequest keep updating the View reactively, but respect the fetchLimit to always show the latest 3 Items only?
1
3
412
Aug ’23
NSNumberFormatter wrongfully displays 16-bit unsigned int as signed
Hi all, My interface displays a text field bound to an NSNumber that I use internally as unsigned int. That NSNumber is actually saved with Core Data as Integer 16. However, the interface displays the number signed, meaning anything above 32.768 is actually shown to be negative. I couldn't find a way to force my NSNumberFormatter to display unsigned numbers. Setting the minimum value to 0 also doesn't work, since internally it's gonna be positive anyway. Could you help me display my 16-bit integer as an unsigned int between 0 and 65.535? I am building a macOS app using Objective-C, macOS SDK 10.14 and Xcode 14.3.1.
1
0
493
Aug ’23
SwiftData error: NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
I am using SwiftData for my model. Until Xcode 15 beta 4 I did not have issues. Since beta 5 I am receiving the following red warning multiple times: 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release This seems to be a CoreData warning. However, I am not using CoreData directly. I have no way to change the config of CoreData as used by SwiftData. My model just uses UUID, Int, String, Double, some of them as optionals or Arrays. I only use one attribute (.unique).
4
1
1.5k
Sep ’23
How to call swiftdata .fetch inside the Init of a SwiftUI View?
I have a list of swiftdata objects I want to fetch and show in a swift UI list. My problem is the swiftdata object in my DB is not the object I directly want to use in my view. I want to map it to a different viewModel and use that which makes my life wayyy easier. problem is every single example I see online of swift data, just uses the magic @Query operator to get their data, and then directly show it on the UI. What's the best way for me to load the data on initialization but map it to a different type? I've tried this, but it just crashes. init() { do { modelContainer = try ModelContainer(for: MY_DATA_CLASS.self) } catch { fatalError("Could not initialize ModelContainer") } let serverList = FetchDescriptor<MY_DATA_CLASS>( sortBy: [SortDescriptor(\.displayOrder)] ) do { viewModels = try modelContext.fetch(serverList).map { ViewModel(server: $0) } } catch { print(" WHAT THE HECKKK: " + error.localizedDescription) } } NSFetchRequest could not locate an NSEntityDescription for entity name .... any suggestions greatly appreciated. Using @query works fine so I know the rest of the DB is setup correctly.
2
0
1.4k
Aug ’23
Core Data foreign key/relationship between two tables
hi, this is a very simple concept that I can't seem to solve using relationships with core data between two tables. for instance, I have a client table with a name field that I want to link to a client details table with a clientName field and when I update/edit the client name, this still stays links to the client details record. make sense? I tried relationships but it does not link up when I edit the client name. I feel like I'm missing something very obvious here and have tried multiple scenarios but I'm not finding a solution nor am I finding any documentation on how this should work. any help/ideas is appreciated. Thank you, Pete
0
0
393
Aug ’23
Can I access CloudKit's metadata fields with NSPersistentCloudKitContainer?
I've got a simple Core Data Entity that is synchronized with CloudKit via NSPersistentCloudKitContainer. I can read my local fields, but how can I read fields like "Created" & "Modified" from CloudKit? Do I have to add them to my Core Data model and populate them myself? P.S. In his fantastic WWDC talk "Using Core Data with CloudKit", at around 21:40, Nick Gillet talks about how Core Data entities in the CloudKit store are prefixed with "CD_" to separate the things that it manages from the ones CloudKit implements. Then he says: "You wouldn't believe how many people add modify date to their CKRecord". Like it's something redundant.
0
0
408
Aug ’23
cannot push coredata records to cloudkit
coredata pushed schema to cloudkit only for those entities for which I created records. But the record data did not get pushed. I set recordName as Queryable and modifiedTimestamp as both Queryable and sortable. Query does not show the records. I look at Xcode console gives this output for one of the entities that got pushed to cloudkit : CoreData: debug: CoreData+CloudKit: -[PFCloudKitSerializer newCKRecordsFromObject:fullyMaterializeRecords:includeRelationships:error:](575): Serializer has finished creating record: <CKRecord: 0x13f40f920; recordType=CD_Contact, recordID=26809600-B329-4C17-B3E1-6EA5FC177F7C:(com.apple.coredata.cloudkit.zone:__defaultOwner__), values={ "CD_contact" = "26809600-B329-4C17-B3E1-6EA5FC177F7C"; "CD_contactEmail_ckAsset", "CD_contact", "CD_contactEmail", "<CKRecord: 0x13f40f920; recordType=CD_Contact, recordID=26809600-B329-4C17-B3E1-6EA5FC177F7C:(com.apple.coredata.cloudkit.zone:__defaultOwner__), recordChangeTag=5, values={\n \"CD_email\" = Email;\n \"CD_entityName\" = Contact;\n \"CD_firstName\" = V;\n \"CD_imageName\" = \"{ length=20834, sha256=d582bd2ccc7d93138b3a5ad4799443152860268e34f48ace54a0708f3e2f3aba }\";\n \"CD_lastName\" = R;\n \"CD_phone\" = 2;\n \"CD_screenName\" = Vr;\n \"CD_userRating\" = \"*****\";\n \"CD_userType\" = Household;\n}>", Also schema for some other entities that do not have any core data records did not get pushed to CloudKit. I thought the entire coredata schema should get pushed along with the records. Looks like it is pushing those entities that have some records but without pushing data. I reset the cloudkit environment and tried again, but issue is not resolved. Also the AppDelegate never gets called. I thought the line below should have called AppDelegate @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate: AppDelegate Cross referenced persistenceController in AppDelegate. That did not help either Code listed below. Please let me know how to fix the above two issues? main struct GreenApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate: AppDelegate static var fcmToken: String? let gcmMessageIDKey = "gcm.Message_ID" let persistenceController = PersistenceController.shared var body: some Scene { WindowGroup { ContentView() .environment(\.managedObjectContext, persistenceController.container.viewContext) } } } struct PersistenceController { static let shared = PersistenceController() static var preview: PersistenceController = { let result = PersistenceController(inMemory: true) let viewContext = result.container.viewContext // for _ in 0..<10 { // let newItem = Item(context: viewContext) // newItem.timestamp = Date() // } do { try viewContext.save() } catch { // Replace this implementation with code to handle the error appropriately. // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. let nsError = error as NSError fatalError("Unresolved error \(nsError), \(nsError.userInfo)") } return result }() let container: NSPersistentCloudKitContainer init(inMemory: Bool = false) { container = NSPersistentCloudKitContainer(name: "Green") if inMemory { container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null") } container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { // Replace this implementation with code to handle the error appropriately. // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. fatalError("Unresolved error \(error), \(error.userInfo)") } }) container.viewContext.automaticallyMergesChangesFromParent = true container.viewContext.mergePolicy = NSMergeByPropertyStoreTrumpMergePolicy // external changes trumping in-memory changes. } } Appdelegate code: class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate, ObservableObject { static var fcmToken: String? let gcmMessageIDKey = "gcm.Message_ID" let persistenceController = PersistenceController.shared func applicationDidFinishLaunching(_ application: UIApplication) { do { // Use the container to initialize the development schema. try persistenceController.container.initializeCloudKitSchema(options: []) } catch { // Handle any errors. fatalError("###\(#function): failed to load persistent stores: \(error)") } if #available(iOS 10.0, *) { // For iOS 10 display notification (sent via APNS) UNUserNotificationCenter.current().delegate = self let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] UNUserNotificationCenter.current().requestAuthorization(options: authOptions, completionHandler: { granted, error in }) } else { let settings: UIUserNotificationSettings = UIUserNotificationSettings(types:[.alert, .badge, .sound], categories: nil) application.registerUserNotificationSettings(settings) } DispatchQueue.main.async { application.registerForRemoteNotifications() } } }
2
0
648
Aug ’23
Save object to shared database
Maybe I'm going about this completely the wrong way but I've got two stores loaded in my app: private and shared. I've got zone-wide sharing enabled and I can update records that exist in the shared database (on the participant device), and see updates sync when changed by the owner. However, is it possible to save a new object specifically to the shared database as the participant? If I create a new object in my managed object context it saves it to the private database. Can provide code if needed but it's more conceptual at this stage.
1
0
669
Aug ’23
Has anyone successfully used NSStagedMigrationManager?
I've been trying to build an example of NSStagedMigrationManager from some Core Data migration tests to replace a custom migration manager solution I'd constructed, without much success. The Core Data model has seven model versions. Most support lightweight migration, but two of the migrations in the middle of the sequence used NSMappingModel. In the first beta, just attempting to construct an NSStagedMigrationManager from the series of stages failed with an unrecognized selector. That no longer happens in b4, but I now get an error that "Duplicate version checksums across stages detected." If I restrict myself to just the first three versions of the model (that only require lightweight migration), I can build the migration manager. But if I attempt to use it to migrate a persistent store, it fails somewhere in NSPersistentStoreCoordinator with a nilError. The documentation is almost nonexistent for this process, and the WWDC session that introduced it isn't much more than a breezy overview. So maybe I'm holding it wrong? (And, yes: FB12339663)
5
0
1k
Feb ’24
SwiftUI cannot fetch entity records
I am trying to get all records from Entity Location and pull the data from the entity to create a array of strings and display in a MenuPicker. In getLocationNames() ForEach statement it never pulls locations even though there are records. Also I do have a warning on that line: Result of 'ForEach<Data, ID, Content>' initializer is unused entity: Location.entity(), sortDescriptors: [NSSortDescriptor(key: "locationName", ascending: true)] ) var locations: FetchedResults<Location> @State private var locationNames: [String] = [] @State private var locationDetails:[String] = [] @State private var selectedLocation: String? = nil @State private var location: Location? = nil var body: some View { NavigationView { ScrollView (showsIndicators: false) { HStack { Text("Select Location") Picker("Location", selection: $selectedLocation , content: { ForEach(locationNames,id: \.self, content: { locationName in Text(locationName ) }) }) .pickerStyle(MenuPickerStyle()) .onReceive([self.selectedLocation].publisher.first()) { value in selectedLocation = value print("selectedLocation: \(selectedLocation ?? "not found")") } .onTapGesture { // self.callWeatherAPI(location: selectedLocation) self.getLocationNames() } Section{ if ($selectedLocation.wrappedValue != nil) { } } header: { Text("**Current Weather**") .padding(.top, 10) } } .navigationTitle("Weather") .toolbar { ToolbarItem(placement: .confirmationAction) { // Button("Save", action: { Task { try? await rI?(nameInput, phoneInput) } }) Button("Detail", action: { onAdd() } ) .foregroundColor(.blue) } } } .onAppear{ self.getLocationNames() } } } func getLocationNames() -> (Void){ ForEach(locations) { location in locationNames.append( self.getLocationString(location: location)) } } private func getLocationString(location: Location) -> String { var locDetails: String = location.locationType! + "; " locDetails += location.locationName! + ", " locDetails += location.zip! return locDetails } }
0
0
377
Jul ’23
Nested Composite Attribute values are not saved in the database
According the WWDC23 presentation “What’s new in Core Data”, “Composite attributes may be nested within each other”. However, in the current macOS and iOS beta builds, only single level composite attributes (without nested composite attributes) are persisted in the SQLite database. Is this still work in progress? See example project in FB12552092.
0
0
486
Jul ’23
Command MappingModelCompile emitted errors but did not return a nonzero exit code to indicate failure
I have a main application and an SDK which is distributed as a Swift Package. Recently I've added a mapping model into my SDK package, and now I'm getting the following errors when I try to build the app: CoreData: error: Executing as effective user 501 CoreData: error: Information for /Users/***/Library/Developer/Xcode/DerivedData/***/SourcePackages/checkouts/***-sdk-ios/Sources/***SDK/Resources/Model.xcmappingmodel/xcmapping.xml CoreData: error: --------------------------- CoreData: error: File Device ID: 0 CoreData: error: Device ID: 16777233 CoreData: error: File Size: 113216 bytes CoreData: error: File inode: 43162361 CoreData: error: File user ID: 501 CoreData: error: File group ID: 20 CoreData: error: File Permissions: CoreData: error: - CoreData: error: 444 CoreData: error: file is not a symbolic link CoreData: error: Information for file system CoreData: error: --------------------------- CoreData: error: File system type: 0x1a CoreData: error: File system flags: 0x4909080 CoreData: error: MNT_JOURNALED CoreData: error: Total data blocks: 59840624 CoreData: error: Free data blocks: 6096129 CoreData: error: Free blocks for nonsuperuser: 6096129 CoreData: error: Total i-nodes: 247099491 CoreData: error: File system ID: 0x1000011, 0x1a CoreData: error: Free i-nodes: 243845160 CoreData: error: Owner UID: 0 CoreData: error: Filesystem type name: apfs CoreData: error: Mount on name: /System/Volumes/Data CoreData: error: Mount from name: /dev/disk3s5 2023-07-25 10:38:10.755 mapc[91717:10554306] Attempt to add read-only file at path file:///Users/***/Library/Developer/Xcode/DerivedData/***/SourcePackages/checkouts/***-sdk-ios/Sources/***SDK/Resources/Model.xcmappingmodel/xcmapping.xml read/write. Adding it read-only instead. This will be a hard error in the future; you must specify the NSReadOnlyPersistentStoreOption. Command MappingModelCompile emitted errors but did not return a nonzero exit code to indicate failure When I clone my SDK and drag-and-drop the SDK's repo directly to the workspace, so Xcode uses the local version, there is no errors. But, when instead I use the "exact version" or "branch", it emits the errors above. Also, the errors are gone if I delete the mapping model file from the SDK. How can I get rid of the errors and leave the mapping model in my SDK at the same time?
0
0
435
Jul ’23
Potential problem with synching users' private CloudKit with NSPersistentCloudKitContainer
Imagine I have a game with new levels every day. Users play my game and their progress is saved in Core Data, which is then synchronized with CloudKit via NSPersistentCloudKitContainer. Users' progress is about 500Kb for each level/day. That's 5 Mb in 10 days. Or 182 Mb in a year. If the user plays my game for a year, gets a new iPhone, and installs my app again — will the NSPersistentCloudKitContainer eventually download all 182 Mb of users' data!?
1
0
419
Jul ’23
CoreData Failure During Entity Creation in the ViewContext
I have a program that reads in 3 json files and updates CoreData if one or more of the JSON files contains new data. It runs successfully 9 times out of 10. The failure occurs during the creation of an entity in the managed object context. The failure occurs in the function AddRecordsToCoreData. I have placed the error messages below the offending line of code. Further, it appears to only fail during the third call to UpdateCoreDataRecoreds which in turn calls AddRecordsToCoreData. Setting up the calls to run in series I thought I could eliminate any problems but clearly not the case. What error am I making in the code? Or is there some other approach I should utilize? Below is the code in question. class UpdateCoreData: ObservableObject { let persistentContainer = CoreDataStack.shared.persistentContainer @Published var loadingData: Bool = true @Published var updateStatus: String = "" init() { Task { async let fund1Complete: Bool = UpdateCoreDataRecords(fundName: "Fund1", moc: persistentContainer.viewContext) let _ = await (fund1Complete) async let fund2Complete: Bool = UpdateCoreDataRecords(fundName: "Fund2", moc: persistentContainer.viewContext) let _ = await (fund2Complete) async let fund3Complete: Bool = UpdateCoreDataRecords(fundName: "Fund3", moc: persistentContainer.viewContext) let _ = await (fund3Complete) persistentContainer.viewContext.vacuum() let persistentStore = persistentContainer.persistentStoreCoordinator.persistentStores.first do { try persistentContainer.persistentStoreCoordinator.remove(persistentStore!) } catch { print("Unable to remove store -> \(error)") } DispatchQueue.main.async { self.loadingData = false self.updateStatus = "Core Date is Updated" } } } } func UpdateCoreDataRecords(fundName: String, moc: NSManagedObjectContext) async -> Bool { var latestDate: Date = Date() var decodedJSON: TradingDays = TradingDays.init(tradingday: []) latestDate = await LatestCoreDataDate(fundName: fundName, moc: moc) decodedJSON = await DecodeJSONFile(fileName: fundName) await AddRecordsToCoreData(jsonData: decodedJSON, fundName: fundName, latestDate: latestDate, moc: moc) return true } func LatestCoreDataDate(fundName: String, moc: NSManagedObjectContext) async -> Date { var coreDataValues: [TradingDayClose] = [] var latestDate: Date = Date() let fetchRequest: NSFetchRequest<TradingDayClose> = TradingDayClose.fetchRequest() fetchRequest.sortDescriptors = [NSSortDescriptor(key: "timeStamp", ascending: false)] fetchRequest.predicate = NSPredicate(format: "fundName = %@", fundName) fetchRequest.fetchLimit = 1 do { coreDataValues = try moc.fetch(fetchRequest) } catch let error { print("Error fetching max date. \(error.localizedDescription)") } if coreDataValues.isEmpty { latestDate = Calendar.current.date(byAdding: DateComponents(year: -6), to: latestDate)! } else { latestDate = coreDataValues[0].timeStamp! } return latestDate } func AddRecordsToCoreData(jsonData: TradingDays, fundName: String, latestDate: Date, moc: NSManagedObjectContext) async { print("\(fundName)") for item in jsonData.tradingday { if item.timeStamp > latestDate { let newRecord = TradingDayClose(context: moc) // Thread 4: EXC_BAD_ACCESS (code=1, address=0x8) // thread 3 signal Sigbrt // Thread 2: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) newRecord.fundName = fundName newRecord.id = UUID() newRecord.timeStamp = item.timeStamp newRecord.close = (item.close) as NSDecimalNumber } else { break } } if moc.hasChanges { do { print("Saving moc") try moc.save() } catch { print("Errors attempting to save moc") } } }
2
0
584
Jul ’23