If Cloudkit is enabled, SwiftData @Query operation hangs when the View scenePhase becomes active.
Seems like the more @Query calls you have, the more it hangs.
This has been first documented some time ago, but in typical Apple style, it has not been addressed or even commented on.
https://developer.apple.com/forums/thread/761434
iCloud & Data
RSS for tagLearn how to integrate your app with iCloud and data frameworks for effective data storage
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
If I use <FetchRequest.returnsDistinctResults> with unique "identifier" property, and there happened to be multiple NSManagedObjects in Core Data that contains the same "identifier", does the FetchRequest retrieve the latest modified/created object?
Is there a way to define the <FetchRequest.returnsDistinctResults> logic to be based on another property (e.g. "creationDate" / "modifiedDate") and the ascension order?
Topic:
App & System Services
SubTopic:
iCloud & Data
hi,
in my app, i have created and pushed CKRecords to the public database. others using the app have pushed CKRecords as well.
is there any way i can query iCloud for "all the CKRecords that i created?"
thanks,
DMG
Topic:
App & System Services
SubTopic:
iCloud & Data
This simple test fails in my project. Similar code in my application also crashes.
How do I debug the problem?
What project settings are required. I have added SwiftData as a framework to test (and application) targets?
Thanks,
The problem is with:
modelContext.insert(item)
Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
import XCTest
import SwiftData
@Model
class FakeModel {
var name: String
init(name: String) { self.name = name }
}
@MainActor
final class FakeModelTests: XCTestCase {
var modelContext: ModelContext!
override func setUp() {
super.setUp()
do {
let container = try ModelContainer(for: FakeModel.self, configurations: ModelConfiguration(isStoredInMemoryOnly: true))
modelContext = container.mainContext
} catch {
XCTFail("Failed to create ModelContainer: \(error)")
modelContext = nil
}
}
func testSaveFetchDeleteFakeItem() {
guard let modelContext = modelContext else {
XCTFail("ModelContext must be initialized")
return
}
let item = FakeModel(name: "Test")
modelContext.insert(item)
let fetchDescriptor = FetchDescriptor<FakeModel>()
let items = try! modelContext.fetch(fetchDescriptor)
XCTAssertEqual(items.count, 1)
XCTAssertEqual(items.first?.name, "Test")
modelContext.delete(item)
let itemsAfterDelete = try! modelContext.fetch(fetchDescriptor)
XCTAssertEqual(itemsAfterDelete.count, 0)
}
}
Hi,
I am currently experiencing some trouble when using parent model property in a predicate of a child model.
I have an Item class that define parent-child relationship:
@Model class Item {
var timestamp: Date
@Relationship(inverse: \Item.children)
var parent: Item?
var children: [Item]
init(parent: Item? = nil, children: [Item] = [], timestamp: Date = .now) {
self.parent = parent
self.children = children
self.timestamp = timestamp
}
}
I subclass this model like that:
@available(iOS 26, *)
@Model final class CollectionItem: Item { /* ... */ }
When i make a Query in my View like that the system crashes:
@Query(
filter: #Predicate<CollectionItem> { $0.parent == nil },
sort: \CollectionItem.name,
)
private var collections: [CollectionItem]
CrashReportError: Fatal Error in DataUtilities.swift
AppName crashed due to fatalError in DataUtilities.swift at line 85.
Couldn't find \CollectionItem.<computed 0x000000034005d4e8 (Optional<Item>)> on CollectionItem with fields [SwiftData.Schema.PropertyMetadata(name: "name", keypath: \CollectionItem.<computed 0x000000034003c120 (String)>, defaultValue: nil, metadata: nil), SwiftData.Schema.PropertyMetadata(name: "icon", keypath: \CollectionItem.<computed 0x000000034003ca04 (Optional<String>)>, defaultValue: nil, metadata: nil), SwiftData.Schema.PropertyMetadata(name: "timestamp", keypath: \Item.<computed 0x0000000340048018 (Date)>, defaultValue: nil, metadata: nil), SwiftData.Schema.PropertyMetadata(name: "parent", keypath: \Item.<computed 0x0000000340048a4c (Optional<Item>)>, defaultValue: nil, metadata: Optional(Relationship - name: , options: [], valueType: Any, destination: , inverseName: nil, inverseKeypath: Optional(\Item.<computed 0x0000000340048fe8 (Array<Item>)>))), SwiftData.Schema.PropertyMetadata(name: "children", keypath: \Item.<computed 0x0000000340048fe8 (Array<Item>)>, defaultValue: nil, metadata: nil)]
When I query as Item it works but then i cannot sort on CollectionItem field and must add unnecessary down casting:
@Query(
filter: #Predicate<Item> { $0.parent == nil && $0 is CollectionItem },
)
private var items: [Item]
Am I missing something? Is it a platform limitation or a known issue?
My Code:
let op = CKModifyRecordsOperation(recordIDsToDelete:recordIDsToDelete)
op.modifyRecordsCompletionBlock = { _, deleteRecordIDs, error in
if error == nil {
print("successful delete deleteRecordIDS = \(deleteRecordIDs)")
} else {
print("delete error = \(error?.localizedDescription)")
}
}
op.database = CKContainer.default().privateCloudDatabase
op.qualityOfService = .userInitiated
CKContainer.default().privateCloudDatabase.add(op)
My problem is that CKRecord are not deleted once I reinstall the app: when I reinstall the app and try to delete a CloudKit record, the method is executed successfully (error is nil) but the records are still in CloudKit Dashboards.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
CloudKit
CloudKit Dashboard
CloudKit Console
I have some code which handles doing some computation on a background thread before updating Core Data NSManagedObjects by using the NSManagedObjectContext.perform functions.
This code is covered in Sendable warnings in Xcode 26 (beta 6) because my NSManagedObject subclasses (autogenerated) are non-Sendable and NSManagedObjectContext.perform function takes a Sendable closure.
But I can't really figure out what I should be doing. I realize this pattern is non-ideal for Swift concurrency, but it's what Core Data demands AFAIK. How do I deal with this?
let moc = object.managedObjectContext!
try await moc.perform {
object.completed = true // Capture of 'object' with non-Sendable type 'MySpecialObject' in a '@Sendable' closure
try moc.save()
}
Thanks in advance for your help!
"No records found"
If I create a new record on the console, I can copy the record name.
I can then query for recordName and get that individual record back.
BUT no other queries work. I cannot query all records. I cannot query by individual property.
Just returns "no records found"
Seems like my indexes got messed up. Is there a way to reset indexes on prod?
This is on a coredata.cloudkit managed zone.
I have a UIKit app where I've adopted SwiftData and I'm struggling with a crash coming in from some of my users. I'm not able to reproduce it myself and as it only happens to a small fraction of my user base, it seems like a race condition of some sort.
This is the assertion message:
SwiftData/DefaultStore.swift:453: Fatal error: API Contract Violation: Editors must register their identifiers before invoking operations on this store SwiftData.DefaultStore: 00CF060A-291A-4E79-BEC3-E6A6B20F345E did not. (ID is unique per crash)
This is the ModelActor that crashes:
@available(iOS 17, *)
@ModelActor
actor ConsumptionDatabaseStorage: ConsumptionSessionStorage {
struct Error: LocalizedError {
var errorDescription: String?
}
private let sortDescriptor = [SortDescriptor(\SDConsumptionSession.startTimeUtc, order: .reverse)]
static func createStorage(userId: String) throws -> ConsumptionDatabaseStorage {
guard let appGroupContainer = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: UserDefaults.defaultAppGroupIdentifier) else {
throw Error(errorDescription: "Invalid app group container ID")
}
func createModelContainer(databaseUrl: URL) throws -> ModelContainer {
return try ModelContainer(for: SDConsumptionSession.self, SDPriceSegment.self, configurations: ModelConfiguration(url: databaseUrl))
}
let databaseUrl = appGroupContainer.appendingPathComponent("\(userId).sqlite")
do {
return self.init(modelContainer: try createModelContainer(databaseUrl: databaseUrl))
} catch {
// Creating the model storage failed. Remove the database file and try again.
try? FileManager.default.removeItem(at: databaseUrl)
return self.init(modelContainer: try createModelContainer(databaseUrl: databaseUrl))
}
}
func isStorageEmpty() async -> Bool {
(try? self.modelContext.fetchCount(FetchDescriptor<SDConsumptionSession>())) ?? 0 == 0 // <-- Crash here!
}
func sessionsIn(interval: DateInterval) async throws -> [ConsumptionSession] {
let fetchDescriptor = FetchDescriptor(predicate: #Predicate<SDConsumptionSession> { sdSession in
if let startDate = sdSession.startTimeUtc {
return interval.start <= startDate && interval.end > startDate
} else {
return false
}
}, sortBy: self.sortDescriptor)
let consumptionSessions = try self.modelContext.fetch(fetchDescriptor) // <-- Crash here!
return consumptionSessions.map { ConsumptionSession(swiftDataSession: $0) }
}
func updateSessions(sessions: [ConsumptionSession]) async throws {
if #unavailable(iOS 18) {
// Price segments are duplicated if re-inserted so unfortunately we have to delete and reinsert sessions.
// On iOS 18, this is enforced by the #Unique macro on SDPriceSegment.
let sessionIds = Set(sessions.map(\.id))
try self.modelContext.delete(model: SDConsumptionSession.self, where: #Predicate<SDConsumptionSession> {
sessionIds.contains($0.id)
})
}
for session in sessions {
self.modelContext.insert(SDConsumptionSession(consumptionSession: session))
}
if self.modelContext.hasChanges {
try self.modelContext.save()
}
}
func deleteAllSessions() async {
if #available(iOS 18, *) {
try? self.modelContainer.erase()
} else {
self.modelContainer.deleteAllData()
}
}
}
The actor conforms to this protocol:
protocol ConsumptionSessionStorage {
func isStorageEmpty() async -> Bool
func hasCreditCardSessions() async -> Bool
func sessionsIn(interval: DateInterval) async throws -> [ConsumptionSession]
func updateSessions(sessions: [ConsumptionSession]) async throws
func deleteAllSessions() async
}
The crash is coming in from line 30 and 41, in other words, when trying to fetch data from the database. There doesn't seem to be any common trait for the crashes. They occur across iOS versions and device types.
Any idea what might cause this?
I've been seeing something that I find odd when using two SwiftData models where if I have one model (book, in this case) that has an optional array of another model (page, in this case), the optional array starts out as set to nil, but after about 20 seconds it updates to being an empty array.
I see it in Previews and after building.
Is this expected behavior? Should I just assume that if there is an optional array in my model it will eventually be initialized to an empty array?
Code is below.
import SwiftUI
import SwiftData
@Model
final class Book {
var title: String = "New Book"
@Relationship var pages: [Page]? = nil
init(title: String) {
self.title = title
}
}
@Model
final class Page {
var content: String = "Page Content"
var book: Book? = nil
init() {
}
}
struct ContentView: View {
@Environment(\.modelContext) private var modelContext
@Query private var books: [Book]
var body: some View {
NavigationSplitView {
List {
ForEach(books) { book in
NavigationLink {
Text("\(book.title)")
Text(book.pages?.debugDescription ?? "pages is nil")
} label: {
Text("\(book.title)")
Spacer()
Text("\(book.pages?.count.description ?? "pages is nil" )")
}
}
}
HStack {
Button("Clear Data") {
clearData()
}
Button("Add Book") {
addBook()
}
}
.navigationSplitViewColumnWidth(min: 180, ideal: 200)
} detail: {
Text("Select an item")
}
}
private func clearData() {
for book in books {
modelContext.delete(book)
}
try? modelContext.save()
}
private func addBook() {
let newBook = Book(title: "A New Book")
modelContext.insert(newBook)
}
}
@main
struct BookPageApp: App {
var sharedModelContainer: ModelContainer = {
let schema = Schema([Book.self, Page.self])
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
do {
return try ModelContainer(for: schema, configurations: [modelConfiguration])
} catch {
fatalError("Could not create ModelContainer: \(error)")
}
}()
var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(sharedModelContainer)
}
}
#Preview {
ContentView()
.modelContainer(for: Book.self, inMemory: true)
}
Environment
visionOS 26
Xcode 26
Issue
I am experiencing crash when trying to access a [String] from a @Model data, after dismissing an immersiveSpace and opening a WindowGroup.
This crash only occurs when trying to access the [String] property of my Model. It works fine with other properties.
Thread 1: Fatal error: This backing data was detached from a context without resolving attribute faults: PersistentIdentifier(...)
Steps to Reproduce
Open WindowGroup
Dismiss window, open ImmersiveSpace
Dismiss ImmersiveSpace, reopen WindowGroup
Any guidance would be appreciated!
@main
struct MyApp: App {
var body: some Scene {
WindowGroup(id: "main") {
ContentView()
}
.modelContainer(for: [Item.self])
ImmersiveSpace(id: "immersive") {
ImmersiveView()
}
}
}
// In SwiftData model
@Model
class Item {
var title: String = "" // Accessing this property works fine
var tags: [String] = []
@storageRestrictions(accesses: _$backingData, initializes: _tags)
init(initialValue) {
_$backingData.setValue(forKey: \. tags, to: initialValue)
_tags =_ SwiftDataNoType()
}
get {
_$observationRegistrar.access(self, keyPath: \.tags)
**return self getValue(forkey: \.tags)** // Crashes here
}
Hello,
I'm trying to work on an iPadOS and macOS app that will rely on the document-based system to create some kind of orientation task to follow.
Let say task1.myfile will be a check point regulation from NYC to SF and task2.myfile will be a visit as many key location as you can in SF.
The file represent the specific landmark location and rules of the game.
And once open, I will be able to read KML/GPS file to evaluate their score based with the current task.
But opened GPS files does not have to be stored in the task file itself, it stay alongside.
I wanted to use that scenario to experiment with SwiftData (I'm a long time CoreData user, I even wrote my own WebDAV based persistent store back in the day), and so, mix both on file and in memory persistent store, with distribution based on object class.
With CoreData it would have been possible, but I do not see how to achieve that with SwiftData and DocumentGroup integration.
Any idea how to do that?
I have a ModelActor that creates a hierarchy of models and returns a PersistentIdentifier for the root. I'd like to do that in a transaction, but I don't know of a good method of getting that identifier if the models are created in a transaction.
For instance, an overly simple example:
func createItem(timestamp: Date) throws -> PersistentIdentifier {
try modelContext.transaction {
let item = Item(timestamp: timestamp)
modelContext.insert(item)
}
// how to return item.persistentModelID?
}
I can't return the item.persistentModelID from the transaction closure and even if I could, it will be a temporary ID until after the transaction is executed.
I can't create the Item outside the transaction and just have the transaction do an insert because swift will raise a data race error if you then try to return item.persistentModelID.
Is there any way to do this besides a modelContext.fetch* with separate unique identifiers?
I work on an app that saves data to the Documents folder in the users iCloud Drive. This uses the iCloud -> iCloud Documents capability with a standard container.
We've noticed an issue where a user will delete the apps data by doing to Settings > {Name} > iCloud > Storage > App Name > select "delete data from iCloud", and then our app can no longer write to or create the Documents folder.
Once that happens, we get this error:
Error Domain=NSCocoaErrorDomain Code=513 "You don't have permission to save the file "Documents" in the folder "iCloud~your~bundle~identifier"." UserInfo={NSFilePath=/private/var/mobile/Library/Mobile Documents/iCloud~your~bundle~identifier/Documents, NSURL=file:///private/var/mobile/Library/Mobile%20Documents/iCloud~your~bundle~identifier/Documents, NSUnderlyingError=0x1102c7ea0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
This is reproducible using the sample project here https://developer.apple.com/documentation/uikit/synchronizing-documents-in-the-icloud-environment.
Steps to reproduce in that project:
Tap the plus sign in the top right corner to create a new document
Add a document name and tap "Save to Documents"
Go to Settings > {Name} > iCloud > Storage > SimpleiCloudDocument App Name > select "delete data from iCloud"
Reopen the app and repeat steps 1-2
Observe error on MainViewController+Document.swift:59
Deleting and reinstalling the app doesn't seem to help.
Topic:
App & System Services
SubTopic:
iCloud & Data
What have people's experience with converting locally stored app data to a more browser based accessible format? Firebase seems expensive, Subabase a bit more challenging, and CloudKit too restrictive.
Hi,
I'm trying to sign in with Apple CloudKit.
I'm using the following code:
'use client';
import { CLOUDKIT_CONSTANTS } from '@/constants/cloudkit';
import { setCloudKitConfigured } from '@/lib/cloudkitSingleton';
import { CloudKitStatic } from '@/types/cloudkit';
import Script from 'next/script';
declare global {
interface Window {
CloudKit: CloudKitStatic;
}
}
export default function Home() {
const initializeCloudKit = async () => {
console.info('⭐️ initializeCloudKit - start');
// 古い認証情報を削除
try {
// LocalStorageから古い認証情報を削除
const keysToRemove = [];
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
if (key && (key.includes('cloudkit') || key.includes('CloudKit'))) {
keysToRemove.push(key);
}
}
keysToRemove.forEach(key => localStorage.removeItem(key));
// SessionStorageからも削除
const sessionKeysToRemove = [];
for (let i = 0; i < sessionStorage.length; i++) {
const key = sessionStorage.key(i);
if (key && (key.includes('cloudkit') || key.includes('CloudKit'))) {
sessionKeysToRemove.push(key);
}
}
sessionKeysToRemove.forEach(key => sessionStorage.removeItem(key));
console.log('古い認証情報を削除しました');
} catch (cleanupError) {
console.warn('認証情報のクリーンアップ中にエラー:', cleanupError);
}
try {
const cloudKit = window.CloudKit.configure({
containers: [
{
containerIdentifier: 'XXXXXX',
apiTokenAuth: {
apiToken: 'XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX',
persist: false,
signInButton: {
id: 'cloudkit-sign-in-button',
theme: 'black',
},
signOutButton: {
id: 'cloudkit-sign-out-button',
theme: 'black',
},
},
environment: 'development',
},
],
});
console.info('⭐️ cloudKit', cloudKit);
setCloudKitConfigured(true);
const container = cloudKit.getDefaultContainer();
console.info('⭐️ CloudKit configured, setting up auth...');
// 初期認証状態をチェック
try {
const initialUser = await container.setUpAuth();
console.info('⭐️ setUpAuth result:', initialUser);
} catch (authError) {
console.info('⭐️ setUpAuth error (expected for unauthenticated):', authError);
}
// CloudKitの標準コールバックも併用(念のため)
try {
container.whenUserSignsIn().then((userInfo: any) => {
console.info('⭐️ CALLBACK: whenUserSignsIn fired!', userInfo);
});
container.whenUserSignsOut().then(() => {
console.info('⭐️ CALLBACK: whenUserSignsOut fired!');
});
} catch (callbackError) {
console.info('⭐️ Callback setup error (non-critical):', callbackError);
}
console.info('⭐️ initializeCloudKit - completed');
} catch (error) {
console.error('⭐️ Critical CloudKit initialization error:', error);
}
};
return (
<>
<Script
src="https://cdn.apple-cloudkit.com/ck/2/cloudkit.js"
strategy="afterInteractive"
onLoad={() => {
initializeCloudKit();
}}
onError={error => {
console.error('⭐️ CloudKit initialization error:', error);
}}
/>
<div id="cloudkit-sign-in-button" />
<div id="cloudkit-sign-out-button" />
</>
);
}
In Chrome secret tab, I can sign in successfully.
But in Chrome normal tab, I can't sign in.
In normal tab, following error occurs on sign in button click:
cloudkit.js:14 Uncaught (in promise) Error: UNKNOWN_ERROR
cloudkit.js:14 GET https://api.apple-cloudkit.com/database/1/XXXXXX/XXXXXX/public/users/caller?ckjsBuildVersion=2420ProjectDev22&ckjsVersion=2.6.4&clientId=XXXXX-XXXXXXX-XXXX-XXXXX&
ckAPIToken=XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX
421 (Misdirected Request)
I think, cloudkit instance has re-initialized when I click the sign in button only in normal tab.
So I can't sign in.
Do you have any idea what might be causing the error ?
Thanks in advance for your help!
LSUB always returns all the subscribed folders. For example
lsub "" "test/*"
returns a list of all the folders and not just subscribed folders that are subfolders of test. I.e, it returns the same folder list as
lsub "" "*".
For more details please see https://bugzilla.mozilla.org/show_bug.cgi?id=1817707#c15
I'm working on a macOS app with a Safari web extension. I'm trying to share a SwiftData model between devices using CloudKit synchronization. I am able to get synchronization in the main app on the same device, CloudKit sync works correctly — changes appear in the CloudKit Dashboard under com.apple.coredata.cloudkit.zone.
However, in the Safari App Extension, data is saved locally and persists across launches, but never syncs to CloudKit.
I have followed the recommended practices for configuring the App Group and entitlements, but the issue persists.
Questions:
Is there an official limitation preventing Safari App Extensions from connecting to the CloudKit daemon (cloudd)?
If not, what entitlements or configuration changes are required for a Safari App Extension to successfully sync with CloudKit?
Is the xpc_error=159 from bootstrap_look_up() a known sandbox restriction for this extension type?
Any guidance from Apple engineers or others who have successfully used CloudKit from a Safari App Extension would be appreciated.
What I’ve confirmed:
The extension’s .entitlements includes:
com.apple.security.app-sandbox
com.apple.developer.icloud-services
CloudKit
com.apple.developer.icloud-container-identifiers
iCloud.dev.example.myapp
Same iCloud container ID for both app and extension
CloudKit container exists and is initialized in CloudKit Console
Running in :Sandbox environment during development
Database name in SwiftData matches container identifier (without the iCloud. prefix)
The extension’s codesign output shows correct entitlements
App Group is configured (although in this case, extension and app use separate stores intentionally)
Observed behavior in Console.app logs:
CloudKit sync engine initializes in the extension
XPC activities are registered for import/export:
_xpc_activity_register: com.apple.coredata.cloudkit.activity.export.
xpc_activity_set_criteria: ... import.
Then a bootstrap lookup fails:
failed to do a bootstrap look-up: xpc_error=[159: Unknown error: 159]
CloudKit daemon connection error:
CKErrorDomain Code=6 "Error connecting to CloudKit daemon"
NSCocoaErrorDomain Code=4099
There is no “Will attempt to upload transactions” or “Upload succeeded” logs are ever seen.
Symptoms
When the extension is run, I see logs like the following in Console.app:
[0x13e215820] failed to do a bootstrap look-up: xpc_error=[159: Unknown error: 159]
CoreData+CloudKit: -[PFCloudKitSetupAssistant _checkAccountStatus:]_block_invoke(342): Fetched account info for store : (null)
Error Domain=CKErrorDomain Code=6 "Error connecting to CloudKit daemon. This could happen for many reasons..."
Hello,
I'm planning to had an onboarding to one of my apps. I am thinking about a way for a user to not see the onboarding again if he installs the app on another device. So for example, the user completes the onboarding on its iPhone, then downloads the app on its iPad and launch it, he doesn't see the onboarding a second time.
I thought about using iCloud NSUbiquitousKeyValueStored to store the onboarding completion state.
But I'm not sure when the data is synced to the other device logged into the same Apple account:
Immediately even if the app is not installed on the other device (independent from the app, only iCloud thing)?
At the same time as the app install on the other device?
After the app is first launched on the other device?
Of course synchronisation will depend on the Internet connection, speed, etc. so the app should handle the case where the data is not here but what would be the best case scenario?
Thank you,
Axel
Topic:
App & System Services
SubTopic:
iCloud & Data
I have an app that I signed and distribute between some internal testflight users. Potentially I want to invite some 'Public' beta testers which don't need to validate (_World have read rights in the public database)
Question: Do I need to have a working public CloudKit , when users are invited through TestFlight, or are they going to test on the development container?
I understand that when I invite beta-tester without authorization (external testers) they cannot access the developer container, so therefore I need to have the production CloudKit container up and running.
I have tried to populate the public production container, but for whatever reason my upload app still goes to the development container. I have archived the app, and tried, but no luck. I let xcode manage my certificates/profiles. but what do I need to change to be able to use my upload file to upload the production container, instead of the development.
I tried:
init() {
container = CKContainer(identifier: "iCloud.com.xxxx.xxxx")
publicDB = container.publicCloudDatabase
I got no error in the console, but data is always populated to the development database, instead the production.
I tried to create a provisioning profile, but for some reason Xcode doesn't like it. Tried to create one a different provisioning profile manual through the developer portal, for the app. but xcode doesn't want to use that, and mentions that the requirement are already in place.
What can I check/do to solve this.