iCloud & Data

RSS for tag

Learn how to integrate your app with iCloud and data frameworks for effective data storage

CloudKit Documentation

Post

Replies

Boosts

Views

Activity

NSPersistentStoreCoordinator crash (routeHeavyweightBlock?)
Hello, I recently published an app on the App Store. I see a crash log from one of my users, but don't understand the reason CoreData crashed. It was simply saving a single object, and all the properties of it are optional. I am unable to reproduce the crash, and in the over 8 moths of development before release, I did not encounter this type of error. Please provide assistance, or where I could do some more research. I included part of the crash log below. Thank you very much. Hardware Model: iPhone15,4 Process: Proaneer Version: 1.0.3 (50) AppStoreTools: 15A240a AppVariant: 1:iPhone15,4:17 Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Date/Time: 2023-10-01 09:14:05.6888 -0400 Launch Time: 2023-10-01 09:08:34.4421 -0400 OS Version: iPhone OS 17.0.2 (21A350) Release Type: User Baseband Version: 1.00.03 Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: SIGNAL 6 Abort trap: 6 Terminating Process: Proaneer Triggered by Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x19a4565e0 __exceptionPreprocess + 164 (NSException.m:249) 1 libobjc.A.dylib 0x192767c00 objc_exception_throw + 60 (objc-exception.mm:356) 2 CoreData 0x1a2609410 -[NSPersistentStoreCoordinator _introspectLastErrorAndThrow] + 120 (NSPersistentStoreCoordinator.m:0) 3 CoreData 0x1a24f3fbc __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke.541 + 680 (NSPersistentStoreCoordinator.m:0) 4 CoreData 0x1a24f3c2c -[NSPersistentStoreCoordinator _routeHeavyweightBlock:] + 264 (NSPersistentStoreCoordinator.m:641) 5 CoreData 0x1a24d05b4 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1048 (NSPersistentStoreCoordinator.m:2768) 6 CoreData 0x1a24d05d8 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1084 (NSPersistentStoreCoordinator.m:3425) 7 CoreData 0x1a24c1e84 -[NSManagedObjectContext save:] + 972 (NSManagedObjectContext.m:1625) 8 Proaneer 0x102f2e268 ContactListViewModel.saveContact(functionName:functionAction:count:) + 96 (ContactListViewModel + CRUD Ext..swift:151) 9 Proaneer 0x102f2e1e4 ContactListViewModel.createContact() + 2496 (ContactListViewModel + CRUD Ext..swift:50) 10 Proaneer 0x102f7e08c closure #1 in closure #1 in closure #2 in closure #1 in closure #5 in ContactListRootView.body.getter + 84 (ContactListRootView.swift:203)
1
1
363
Oct ’23
SwiftData Relationship
I have 2 classes and a relationship from one to another... I am getting an error while runtime. Can someone help me with this issue??.. @storageRestrictions(accesses: _$backingData, initializes: _trans) init(initialValue) { _$backingData.setValue(forKey: \.trans, to: initialValue) _trans = _SwiftDataNoType() } get { _$observationRegistrar.access(self, keyPath: \.trans) return self.getValue(forKey: \.trans) } set { _$observationRegistrar.withMutation(of: self, keyPath: \.trans) { self.setValue(forKey: \.trans, to: newValue) } } } Thread 1: EXC_BREAKPOINT (code=1, subcode=0x25256ead8) Below is my class... import SwiftData @Model final class Main { var name: String var limit: Double @Relationship(deleteRule: .cascade) var trans: [Child] = [] init(name: String, limit: Double, trans: [Child]) { self.name = name self.limit = limit self.trans = trans } } @Model final class Child { var trip: String var distance: Double init(trip: String, distance: Double) { self.trip = trip self.distance = distance } }
2
0
760
Oct ’23
Unable to initialize `ValueTransformer` for UIImageTransformer
I generated model classes using XCode's auto-generate functionality while trying to migrate from CoreData to SwiftData. I get a fatal error on launch - Thread 1: Fatal error: Unable to initialize ValueTransformer for UIImageTransformer Any suggestions are welcome! Please find the code below: import SwiftData import UIKit @Model public class ******** { public var id: UUID = UUID() var idDrink: String = "" @Attribute(.transformable(by: UIImageTransformer.self)) var image: UIImage? var isFavourite: Bool = false var order: Int16 = 0 var strAlcoholic: String = "" var strCategory: String = "" @Attribute(.unique) var strDrink: String = "" var strDrinkThumb: String = "" var strGlass: String = "" var strImageSource: String = "" var strInstructions: String = "" @Relationship(inverse: \Component.********) var ingredient: [Component] = [] public init() { } } import Foundation import SwiftData @Model public class Component { var measure: String? var name: String? var ********: ********? public init() { } } Value transformer: import UIKit class UIImageTransformer: ValueTransformer { static let name = NSValueTransformerName(rawValue: "UIImageTransformer") override func transformedValue(_ value: Any?) -> Any? { guard let image = value as? UIImage else { return nil } do { let data = try NSKeyedArchiver.archivedData(withRootObject: image, requiringSecureCoding: true) return data } catch { return nil } } override func reverseTransformedValue(_ value: Any?) -> Any? { guard let data = value as? Data else { return nil } do { let image = try NSKeyedUnarchiver.unarchivedObject(ofClass: UIImage.self, from: data) return image } catch { return nil } } override public class func transformedValueClass() -> AnyClass { return UIImage.self } override public class func allowsReverseTransformation() -> Bool { return true } static func register() { ValueTransformer.setValueTransformer(UIImageTransformer(), forName: name) } } App: import SwiftUI @main struct CocktailsSwiftUIApp: App { // MARK: Body var body: some Scene { WindowGroup { ContentView() } .modelContainer(for: [********.self, Component.self]) } }
1
0
433
Oct ’23
Access iOS app CoreData in Swift extension?
This should be simple, but it's proving immensely difficult and annoying. I have three targets in the project: an iOS app written in Objective-C a Watch App written in Swift/SwiftUI a Widget Extension with my widgets and complications in, written in Swift/SwiftUI I want to access the Core Data that's got all my app's data in it from the Widget Extension and Watch App. How do I do this? Every internet search result assumes all your targets are in Swift, and it's really not feasible for me to rewrite the entire app. All three targets have the same App Group set up, and I can access UserDefaults in each target. I have a CoreData.swift class in a shared folder, and it's a member of both the Watch App and Widget Extension targets. It has this in it: lazy var persistentContainer: NSPersistentContainer = { let storeURL = URL.storeURL(for: kAppGroup, databaseName: kCoreDataModel) let storeDescription = NSPersistentStoreDescription(url: storeURL) let container = NSPersistentContainer(name: kCoreDataModel) container.persistentStoreDescriptions = [storeDescription] container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError("CoreData: Failed to initialise Managed Object Model from url: \(storeURL), with error: \(error), \(error.userInfo)") } }) return container }() and the storeURL extension is: public extension URL { static func storeURL(for appGroup: String, databaseName: String) -> URL { guard let fileContainer = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroup) else { fatalError("CoreData: Shared file container could not be created.") } return fileContainer.appendingPathComponent("\(kCoreDataModel).sqlite") } } To be clear, the main iOS app (in Objective-C) has created the Core Data model etc., and it all works fine. I just want to be able to access the data in that model from the other targets. (I only need read access.) When I deploy to a device the stack looks like this: NSURL *dataModelFolderURL = [[[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:kAppGroup] URLByAppendingPathComponent:kCoreDataFolder]; Is: /private/var/mobile/Containers/Shared/AppGroup/9F329A90-C897-4AA2-87DF-D98A9E85356A/data-model NSURL *modelURL = [[NSBundle mainBundle] URLForResource:kCoreDataModel withExtension:@"momd"]; Is: file:///private/var/containers/Bundle/Application/CA9E3697-C4C6-48CB-89EA-CC441A6F81AF/MyApp.app/TheDataModel.momd/ // Wait until we have the store, or fetches will sometimes return no data [self performSelectorOnMainThread:@selector(getStore) withObject:nil waitUntilDone:YES]; storeURL = file:///private/var/mobile/Containers/Shared/AppGroup/9F329A90-C897-4AA2-87DF-D98A9E85356A/data-model/TheDataModel I've tried getting the Swift targets to look in a bunch of different paths, but nothing works. When I try to get a count of objects in the Core Data I always get zero results. The second of those outputs is from the bundle. I guess that's because the data model is held within the iOS app's structure? Does that make any difference? Should it be held somewhere else? If so, what should it be? (Minor rant: There really should be an option in Xcode that says, "This core data is shared here, here and here, and all you need to do is type CoreData.getSomeData() and you're done", but no, we have to write boilerplate code for everything.) Anyway... any help is appreciated.
1
0
581
Oct ’23
Core Data query for Transformable
Hi, in my Core Data model, I’m using Transformable to store values of different kinds to the same attribute (I’m creating a user generated filter for data, that could filter for Integers, Boolean or other values - to avoid creating attributes for each possible types i‘m using transformable Any). now, while querying for these values, I’ve noticed that this attribute is never correctly evaluated, but is always false. is it possible to query for Transformable or do I need to change my approach and create an attribute for each possible Type?
0
0
314
Oct ’23
SwiftData with inMemory storage promptly crashes with nw_socket_handle_socket_event
When my code tries to access a SwiftData model's relationship, my app promptly crashes with nw_socket_handle_socket_event [C1.1.1:2] Socket SO_ERROR 61 and no useful information. How do I go about debugging this? I'm creating my modelContainer as inMemory, so I don't think this should be touching any SQLite DB: @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } .modelContainer( for: SchemaV1.models, inMemory: true, isAutosaveEnabled: false, isUndoEnabled: false) } }
1
0
399
Oct ’23
Swift Data value is duplicated between two variables in a class
I'm using two loops, one nested in another to create and assign a subclass to the parent class. I'm using x for one loop and y for the other loop. Print statement shows the loop variables being updated correctly, however the subclass has both variables as the same value. I'm not sure if the value is being stored as the same value or being displayed as the same value. I've checked both creation and display code. I can't find the error. var body: some View { NavigationSplitView { List { ForEach(routes) { item in NavigationLink { Text("Route: \(item.route_name) \nSeason: \(item.route_season)\nCoordinates: \(item.route_coordinates)\nProcessed: \(String(item.route_processed))\nNumber of baseboards: \(item.route_baseboards.count)") } label: { Text(item.route_name) } //end route nav link } //end route for each .onDelete(perform: deleteItems) //end route nav ForEach(baseboards) { item in NavigationLink { //if let test = item.baseboard_heightPoints.count { Text("Grid Size: \(String(item.baseboard_grid_size))\nRow:\(String(item.baseboard_row))\nColumn:\(String(item.baseboard_column))\nHeight Point Count:")//\(String(item.baseboard_heightPoints.flatMap { $0 } .count))") //fix count later //Text("Test") // Text("test2") // } else { // Text("Grid Size: \(String(item.baseboard_grid_size))\nRow:\(String(item.baseboard_row))\nColumn:\(String(item.baseboard_column))\nHeight Point Count: 0") // } } label: { Text(String(item.baseboard_grid_size)) }} .onDelete(perform: deleteItemsBaseboards) //end baseboard route nav // ForEach(heightPoints) { item in NavigationLink { // Text("Row:\(String(item.hp_row))\nColumn:\(String(item.hp_column))\nElevation:\(String(item.hp_elevation))") // } label: { // Text("Row:\(String(item.hp_row))\nColumn:\(String(item.hp_column))") // }} //.onDelete(perform: deleteItemsBaseboards) } .toolbar { ToolbarItem { Button(action: addItem) { Label("Add Route", systemImage: "plus") } //Button(action: addItem) { //not showing up // Label("Add Baseboard", systemImage: "arrow.up") //} } } //end toolbar } detail: { Text("Select a route") } //end NavigationSplitView } //end view body private func addItem() { /*withAnimation { */ let newItem = Route( route_name: "test route " + UUID().uuidString, route_season: "summer", route_processed: false, route_coordinates: "Somewhere", route_region: "US", route_baseboards: []) modelContext.insert(newItem) //end add route //add baseboards to each route let bb_StartCol = 0 let bb_EndCol = 3 let bb_StartRow = 0 let bb_EndRow = 3 //let grid5m = 148 //let grid10m = 76 //let gridHD = 5760 var bb_grid_size = 5760 let bb_sectionsVerticle = 180 let bb_sectionsHorizonal = 360 var sectionData: Data var dataInputArray: [UInt8] = [0x03, 0x00, 0x00, 0x00, 0x00, 0x82, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x20, 0xF8, 0xFF] sectionData = Data(withUnsafeBytes(of: dataInputArray, Array.init)) for x in bb_StartCol...bb_EndCol { //columns for y in bb_StartRow...bb_EndRow { //rows print(x,y) if bb_grid_size < 1000 { let newItem2 = Baseboard( baseboard_column: Int16(x), baseboard_row: Int16(y), texture: "Grid", baseboard_processed: false, baseboard_grid_size: Int16(bb_grid_size),//(x+2)+(y+2), baseboard_heightPoints: Array(repeating: Array(repeating: 0, count: bb_grid_size), count: bb_grid_size), baseboard_HPSection: [], baseboard_route: newItem //baseboard_hps: [] ) modelContext.insert(newItem2) //insert baseboard for each run } else { let newItem2 = Baseboard( baseboard_column: Int16(x), baseboard_row: Int16(y), texture: "Grid", baseboard_processed: false, baseboard_grid_size: Int16(bb_grid_size),//(x+2)+(y+2), baseboard_heightPoints: [], baseboard_HPSection: Array(repeating: Array(repeating: sectionData, count: bb_sectionsVerticle), count: bb_sectionsHorizonal), baseboard_route: newItem //baseboard_hps: [] ) modelContext.insert(newItem2) //insert baseboard for each run } //print(x,y) } //end y for loop - baseboards } //end x for loop - baseboards // } // end animation of adding new items } // end function add items private func deleteItems(offsets: IndexSet) { withAnimation { for index in offsets { modelContext.delete(routes[index]) } } } private func deleteItemsBaseboards(offsets: IndexSet) { withAnimation { for index in offsets { modelContext.delete(baseboards[index]) } } } //private func deleteItemsHeightPoints(offsets: IndexSet) { // withAnimation { // for index in offsets { // modelContext.delete(heightPoints[index]) // } // } // } } #Preview { ContentView() .modelContainer(for: Route.self, inMemory: false) }
3
0
589
Oct ’23
Error while filtering: The isDateInToday(_:) function is not supported in this predicate
I am trying to fetch objects whose date property is within today. When I give a predicate to @Query macro to filter data like this: @Query(filter: #Predicate<Note> { Calendar.current.isDateInToday($0.date) }) private var notes: [Note] I get this error My Note model: @Model final class Note { var date: Date var title: String init(date: Date = Date.now, title: String) { self.date = date self.title = title } } My View: struct ContentView: View { @Environment(\.modelContext) private var modelContext @Query(filter: #Predicate<Note> { Calendar.current.isDateInToday($0.date) }) private var notes: [Note] @State private var newNoteTitle = "" var body: some View { NavigationStack { List { ForEach(notes) { note in Text(note.title) } HStack { TextField("New Note", text: $newNoteTitle) Button { modelContext.insert(Note(title: newNoteTitle)) newNoteTitle = "" } label: { Image(systemName: "plus.circle.fill") } .disabled(newNoteTitle.isEmpty) } } .navigationTitle("Today") } } }
0
2
358
Oct ’23
SwiftData delete underlying file when deleting entity
I have a model like this @Model final struct MyModel { var urlToUnderlyingAsset: URL } I'd like to delete the file at the URL whenever a MyModel gets deleted. Is that possible? My use case is that I'm trying to keep a registry of SCNScenes, but SCNScenes are not Codable. Instead I'm storing URLs to USDZ files. If there's easier ways to keep SCNScenes in a database I'm also open to those.
0
0
371
Oct ’23
App says I need to Set a .modelContext in view's environment to use Query
Only I do: .sheet(isPresented: self.$showMoveItemSheet) { MoveItemsView(items: Array(self.selectedItems), from: self.room) .modelContext(self.context) } .modelContext(self.context) and then in the MoveItemsView I have @Environment(\.modelContext) var context Hm, I'm setting the Query programmatically during init, would that be the cause? 'cause it does seem to work...
1
0
705
Oct ’23
#Predicate and computed properties
I added a Home concept to my simple test program, which made the chain be Home has Rooms which have Items. But when I tried using something like let homeID = self.room.home?.id ?? UUID() _items = Query(#Predicate { ($0.room?.home?.id == homeID) == true }) it complained about an illegal ternary. Fine, it's picky so I changed the Item model to have a computed property: var home: Home? { return self.room?.home?.id } but with that, it crashes at runtime, because it can't find the keypath to .home. Is this all expected?
2
0
478
Oct ’23
Random "duplicate column name" crashes using SwiftData
Hello everyone, I am experiencing a very weird issue. I have a simple relationship between 2 models, that occasionally starts crashing the app, with the following error: error: <NSPersistentStoreCoordinator: 0x28007f6b0>: Attempting recovery from error encountered during addPersistentStore: 0x282523c60 Error Domain=NSCocoaErrorDomain Code=134110 "An error occurred during persistent store migration." UserInfo={sourceURL=file:///private/var/mobile/Containers/Shared/AppGroup/F8286D67-AC8C-4441-A151-13B5AAA509F3/Library/Application%20Support/default.store, reason=Cannot migrate store in-place: I/O error for database at /private/var/mobile/Containers/Shared/AppGroup/F8286D67-AC8C-4441-A151-13B5AAA509F3/Library/Application Support/default.store. SQLite error code:1, 'duplicate column name: Z1POSITIONS', destinationURL=file:///private/var/mobile/Containers/Shared/AppGroup/F8286D67-AC8C-4441-A151-13B5AAA509F3/Library/Application%20Support/default.store, NSUnderlyingError=0x2825c6700 {Error Domain=NSCocoaErrorDomain Code=134110 "An error occurred during persistent store migration." UserInfo={NSSQLiteErrorDomain=1, NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/F8286D67-AC8C-4441-A151-13B5AAA509F3/Library/Application Support/default.store, NSUnderlyingException=I/O error for database at /private/var/mobile/Containers/Shared/AppGroup/F8286D67-AC8C-4441-A151-13B5AAA509F3/Library/Application Support/default.store. SQLite error code:1, 'duplicate column name: Z1POSITIONS', reason=I/O error for database at /private/var/mobile/Containers/Shared/AppGroup/F8286D67-AC8C-4441-A151-13B5AAA509F3/Library/Application Support/default.store. SQLite error code:1, 'duplicate column name: Z1POSITIONS'}}} This is particularly weird because the app runs a few times without any code changes, or any CRUD operations in the database, and then suddenly starts throwing exceptions. These are my models: @Model final class Desk { @Attribute(.unique) let id: UUID let name: String? @Relationship(deleteRule: .cascade) var positions: [DeskPosition] = [] init(id: UUID, name: String?) { self.id = id self.name = name } } @Model final class DeskPosition { let id: UUID var title: String private var heightInCm: Double @Transient var height: DeskHeight { get { DeskHeight(value: heightInCm, unit: .centimeters).localized } set { heightInCm = newValue.converted(to: .centimeters).value } } init(id: UUID, height: DeskHeight, title: String) { self.id = id self.heightInCm = height.converted(to: .centimeters).value self.title = title self.height = height } } And this is my schema and model container (I tried adding both models to the schema, or just adding the parent model, and does not seem to make a difference): private var sharedModelContainer: ModelContainer = { let schema = Schema([Desk.self, DeskPosition.self]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { return try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Could not create ModelContainer: \(error)") } }() I couldn't find anyone else having this same issue. There must be something obviously simple that I am not looking at. Can anyone help? Thank you!
1
0
590
Oct ’23
SwiftData And Non Simple Data Types
I have an SwiftUI app that uses CloudKit. I have model classes and I read and write data to CloudKit. I wanted to convert the app to use SwiftData. Here is a sample model class. @Model class User { var firstName: String? var lastName: String? var location: CLLocation? var photo: Image? } When I read and write this to CloudKit the variables map like this: String -> String CLLocation -> LOCATION Image -> ASSET When I try to compile the above class, I get these error for CLLocation and Image. Instance method 'setValue(forKey:to:)' requires that 'CLLocation' conform to 'PersistentModel' Instance method 'setValue(forKey:to:)' requires that 'Image' conform to 'PersistentModel' How can I use variable types such as CLLocation and Image with SwiftData?
0
1
432
Oct ’23
SwiftData document-based app broken
Hello all Synopsis: document based SwiftData app breaks document handling after first save due to internal error saving the -shm file. Long: i am working on a small document based SwiftData app for macOS. The UI works well as long as the document was not saved. After saving the document and reopening it, I get an error consistently in console: BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: /Users/vrunkel/Library/Containers/de.ecoobs.CurtailmentAnalyzer/Data/tmp/TemporaryItems/NSIRD_CurtailmentAnalyzer_mrXKMs/NewDocument/StoreContent-shm So somehow the -shm file is still referenced to NewDocument created when the app opens an untitled document and resides in the temporary folder. I have saved the document to my documents folder. After reopening and the above error deletion or addition of items crashes the app with a long backtrace to view updating: Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread. I am not creating any threads or do background work. If I do not save the document but work within the new untitled document no problems occur. Even closing the app and reopening the untitled new doc (happens automatically) all is fine. To rule out any influence of my existing view structure I have created the most simple test case - Xcode -> New Project -> macOS document based app configured to use SwiftData. Same behaviour. After saving a new document the addition/deletion of items causes the thread-induced crash and shows the error in console when opening the document. I am using latest versions of Xcode 15.0 and macOS 14.0 Any ideas? thx, volker
6
1
1k
Oct ’23
SwiftData project segfaults when I enabled iCloud sync
The crash is at do { retval = try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Could not create ModelContainer: \(error)") } When I first set it up, it complained (at run-time) about a lot of issues, mainly items not being optional and I apparently had a couple of @Attribute(.unique)s left. After I got rid of all of those, however, I get the crash there. I assume this is an obvious thing that I am doing wrong, but I can't figure it out.
3
0
527
Oct ’23
ModelContainer causes errors depending on the order in which configurations are supplied
Dear community, I am looking for help with an issue that is puzzling me regarding the creation of a SwiftData ModelContainer. I have a ModelContainer that holds some model types that are stored using two different configurations: let fullSchema = Schema([TypeA.self, TypeB.self]) let configurationA = ModelConfiguration(schema: Schema([TypeA.self]), url: "url/to/file/in/app-support/dir") let configurationB = ModelConfiguration(schema: Schema([TypeB.self]), url: "url/to/another/file/in/app-support/dir") let modelContainer = ModelContainer(for: fullSchema, configurations: configurationA, configurationB) // (1) read on I add this container to my view hierarchy using the .modelContainer(modelContainer) view modifier. In on of my views of the app I use a @Query to access objects of type TypeB like this. @Query(sort: \TypeB.someAttribute, order: .reverse) private var arrayOfB: [TypeB] Accessing the view in my app will cause the app to crash with the error: Thread 1: "NSFetchRequest could not locate an NSEntityDescription for entity name 'TypeB'" Now, if I reverse the order in which i specify the configuration for the model container in the line marked // (1) above to let modelContainer = ModelContainer(for: fullSchema, configurations: configurationB, configurationA) the query resolves successfully without crashes. I am looking for information on why the order of the configuration might matter and how to fix this behavior. Please note that because the app is in early development, I do not have objects of type TypeA implemented yet and cannot verify if this behvaior occurrs with these types, too. Edit: This behavior is also true for queries for TypeA. They will not crash the app if the configuration for TypeA is the first configuration passed to the ModelContainer.
1
2
749
Oct ’23
CloudKit Console - Internal Error during Query Records
Issue: I'm experiencing intermittent CloudKit Console 'Internal Error' when performing simple queries on a Private database. I am experiencing this issue with multiple CloudKit databases. In all instances, the issue is intermittent. Steps to Replicate in the CloudKit Console: Select a Database Select Records Select Private Database Select Custom Zone Select Record Type Select Query Records IF the records populate, click 'Query Records' again until Internal Error occurs. Expected Results: A list of records Actual Results: 'Internal Error' (see screenshot below) Additional Info: Starting last month, I started receiving CKCloudKit Error 15 when attempting to sync data from a private CloudKit database. My query code has not changed for a few years now with no previous issues. I believe these errors are the 'same' and on the Apple Server side. Is anyone else experiencing this issue? Any help would be greatly appreciated. Thank you.
3
2
710
Oct ’23
Designing a Word of the Day App: Balancing Local Word Data with Cloud-Based Learning Records"
I have a "Word of the Day" application with a CoreData database containing approximately 14,000 word entities. These entities have attributes like frequency (indicating how often a word appears in some corpus), definition, and pronunciation. Currently, this information is stored locally. I want to add a feature that allows users to store their learning data about these words. For example, users should be able to mark words with a rating of 1, 2, or 3 to indicate their degree of familiarity with the words. My ultimate goal is to display the highest-frequency word with a user familiarity rating of 1 and display it as todays word of the day. The challenge I'm facing is how to set up my app so that learning data is stored in the cloud while the word information remains stored locally. I've seen that you can create different configurations and have one connected to CloudKit, but this approach may make it difficult to write queries that combine information from both the Word entity and the LearningData entity. I'm looking for suggestions on how to address this issue effectively.
0
0
280
Oct ’23