Synchronization works until add Value to a new entity

Hallo,

in my app I have add a new Entity. When I run the app with xcode on my iPhone then everything works well and the synchronization works perfect, also with the new Entity.

When I make build (I have the Entity in the Development and the Production in the Container) and install via Testflight, then the synchronizations of the Data for the Old Entity works perfect.

I can add or edit or delete and it works. But when I add one value to the new Entity, then on the iPhone it be saved and can be used, but the full synchronization stops. For the new Entity also like for the Entities that I had before.

When I uninstall the app and reinstall via Testflight, then it loaded the Data that I had in the App until i try to add a value to the new Entity.

This is the function:

private func saveItem() {
    let request: NSFetchRequest<ToolsSectionsEntity> = ToolsSectionsEntity.fetchRequest()
    request.predicate = NSPredicate(format: "sectionName == %@", inputSectionName)
    
    do {
        let existingSections = try viewContext.fetch(request)
        
        if let editingSection = editingSection {
            if existingSections.isEmpty || (existingSections.count == 1 && existingSections.first == editingSection) {
                editingSection.sectionName = inputSectionName
                
                do {
                    try viewContext.save()
                    
                    updateTools(sectionID: editingSection.wrappedUniqueID, sectionName: inputSectionName)
                    
                    if selectedSectionUniqueID == editingSection.wrappedUniqueID {
                        selectedSectionName = inputSectionName
                    }
                } catch {
                    // Fehler beim Speichern
                    print("Fehler beim Speichern: \(error.localizedDescription)")
                }
                
            } else {
                alertMessage = NSLocalizedString("no double name", comment: "No double name")

                showingAlert = true
            }
        } else {
            if existingSections.isEmpty {
                let newSection = ToolsSectionsEntity(context: viewContext)
                newSection.uniqueID = UUID().uuidString // String der UUID
                newSection.sectionName = inputSectionName
                
                do {
                    try viewContext.save()
                } catch {
                    // Fehler beim Speichern
                    print("Fehler beim Speichern: \(error.localizedDescription)")
                }
            } else {
                alertMessage = NSLocalizedString("no double name", comment: "No double name")
                showingAlert = true
            }
        }
    } catch {
        // Fehler beim Speichern oder Abrufen
        cloudresult = "Fehler beim Speichern: \(error.localizedDescription)"
        print("Fehler beim Speichern oder Abrufen: \(error.localizedDescription)")
    }
}

And i got no error in the catch.

Synchronization works until add Value to a new entity
 
 
Q