Issue with SwiftData: “no such table: ZAPPSETTINGS” and SQLite I/O error on app launch
Hello,
I’m encountering persistent errors with SwiftData in my SwiftUI app related to Core Data’s underlying SQLite database. Despite defining my models correctly, the app fails to initialize the persistent store, throwing the following error on startup:
CoreData error: SQLCore dispatchRequest: no such table: ZAPPSETTINGS. I/O error opening database at /.../default.store. SQLite error code:1, NSSQLiteErrorDomain=1.
File “default.store” couldn’t be opened.
Context
The error only appears concerning my AppSettings model.
I have another model, LocationPoint, which appears correctly defined and used.
I have tried deleting the app, resetting the device, and cleaning builds but the error persists.
The error message suggests the database file is present but the table for ZAPPSETTINGS (the Core Data table for AppSettings) does not exist.
Code Samples
Main App Entry
import SwiftData
import SwiftUI
@main
struct Krow3_0App: App {
@State private var userLocationManager = UserLocationManager()
@State private var geocodingViewModel = GeocodingViewModel()
@State private var locationSearchViewModel = LocationSearchViewModel()
@State private var router = Router()
var body: some Scene {
WindowGroup {
LaunchView()
.environment(userLocationManager)
.environment(geocodingViewModel)
.environment(locationSearchViewModel)
.environment(router)
.modelContainer(for: [LocationPoint.self, AppSettings.self])
}
}
}
AppSettings Model
import Foundation
import SwiftData
@Model
class AppSettings {
var isMetric: Bool
init(isMetric: Bool = false) {
self.isMetric = isMetric
}
}
What I’ve Tried
Fully uninstalling and reinstalling the app on device and simulator.
Resetting the simulator/device.
Cleaning the Xcode build folder.
Verifying the schema logs which correctly list both LocationPoint and AppSettings.
Changing model names to avoid potential conflicts.
Adding .modelContainer configuration with autosave enabled.
Questions
Is there a known bug or limitation with SwiftData concerning certain model setups or naming?
Could this be related to how the data container initializes or migrates schemas?
Are there recommended debugging or migration steps to resolve “no such table” SQLite errors with SwiftData?
How can I safely reset or migrate the persistent store without corrupting the database?
Any insights or suggestions would be greatly appreciated!
Thank you!
This is a dedicated space for developers to connect, share ideas, collaborate, and ask questions. Introduce yourself, network with other developers, and join us in fostering a supportive community.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm building a Live Activity using ActivityKit in iOS, and I'm trying to understand how apps like Uber or Lyft manage to keep the Dynamic Island always in its expanded state, without transitioning through the compact phase.
In my implementation, the Live Activity always starts in the compact state, and only expands temporarily when I interact with it. I've tried the following:
Updating the ContentState frequently using activity.update(using:)
I tried updating the activity every 1 second, but it didn’t make a difference.
Leaving the compactLeading, compactTrailing, and minimal regions empty using EmptyView() — also didn’t change the behavior.
Delaying the initial update by 1 second — no effect.
What I'm trying to figure out:
Is there any way to programmatically force or request the Dynamic Island to stay in the expanded state?
Could this behavior be achieved through push updates, using apns-push-type: liveactivity and a high priority (apns-priority)?
What I’m trying to achieve is similar to the behavior shown in the images below — the apps do not transition to the compact island, but instead displays the expanded view immediately.
Example:
Dear Apple:
After upgrading to version 26 of the iPhone, when broadcasting using the local name, the iPhone 15 Pro Max was truncated to iPhone 15 Pro Ma with a type of 08 (shortened), but the overall length of the broadcast did not exceed 31 bytes
Hey there,
Just writing here to say how I do enjoy the latest update, but I can’t seem to run it on my iPhone 14 Pro well because it tends to overheat. i can deal with the stuttering issues and app crashes, that’s understandable, but for some reason the hardware seem to really heat up after normal use (scrolling on social media platforms).
oh also, I do think rolling back your phone‘s software should be a simpler process as well. It’s not impossible, but the demand of a computer in reinstating a previous backup when iCloud backups your device through WiFi seems like a missed opportunity. Okay. Thank you for reading.
Topic:
Community
SubTopic:
Apple Developers
i am trying to build some projects please check out my project
Maybe a bit of a simplistic question, but….
Best ways to create music - programmatically - within an app?
I have a few small, simple games that I would like to add some background music to. I’ve fiddled with AVAudio, SKAudio, and now AudioKit. I’m just not quite finding the holy grail of music generation. I don’t know if it’s more technique or tool.
So I thought I’d hit up the pool of minds here for some suggestions…?
In the actual development, I found that I could not complete the setting of my icloud+ customised email domain name SMTP.
I tried to configure the SMTP of iCloud custom email according to Apple's document (https://support.apple.com/en-us/102525) but the error
I looked through Apple's support file, but I didn't find the specific configuration of iCloud + customised email SMTP.
I am writing to report a significant battery drain issue after updating my Apple Watch SE (2nd generation) to watchOS 26.0 beta. Since the update, my watch’s battery life has drastically decreased: it goes from 100% to 0% in just 6 hours, whereas previously, under my typical usage, a single charge would last about 1.5 days.
I have already tried the following troubleshooting steps without success:
1. Performed a fresh reset of the watch.
2. Reset my iPhone.
3. Disabled background app activity.
4. Enabled airplane mode and power saving mode.
5. Disabled Live Activities and Photo Memories
Despite these measures, the issue persists. The battery health of my watch is at 90%, so I believe this is likely related to the software update.
I am quite concerned about this situation. I have researched and noticed that similar battery drain problems were reported by beta testers of watchOS 11, and unfortunately, there appeared to be no clear resolution at that time. I rely on my Apple Watch daily, and I sincerely hope this can be addressed soon.
I would appreciate your assistance in resolving this issue, as it is significantly affecting the usability of my Apple Watch.
Thank you for your attention to this matter.
Topic:
Community
SubTopic:
Apple Developers
I’d like to create a button on my iPhone Home Screen that changes settings if I am using an external lens mounted to my phone.
This is what I have along with notes on what I hope to do. But it does not work. I am only able to open either the camera settings or the camera preserve settings but nothing will toggle macro controls.
There is an additional step within the camera app as well but it can be skipped for brevity.
Name: Telephoto and macro lenses
Check if macro settings are already enabled or not. (Settings > Camera > Macro Control toggle) as well as (Settings > Camera > Preserve Settings > Macro Control toggle)
Non-working shortcut code:
Verification question: "Are you using an external lens?"
If yes,
Notification: "Turning on Macro Control and preserve settings for macro control." (Run below immediately)
prefs:root=CAMERA&path=Turn%20On%20Macro_Control
And
prefs:root=CAMERA&path=CameraPreserveSettingsSwitch&path=Turn%20On%20Macro_Control
If no,
Notification: "Turning off Macro Control and Preserve Settings for macro control." (Run below immediately)
prefs:root=CAMERA&path=Turn%20Off%20Macro_Control
And
prefs:root=CAMERA&path=CameraPreserveSettingsSwitch&path=Turn%20Off%20Macro_Control
Hi,
I'm trying the new Swift Testing instead of XCTest for my new project. I am using RxSwift+UIKit. And when I am trying to test my ViewModel that has a Driver in it, it crashes due to the driver is not being called form main thread.
Thread 5: Fatal error: `drive*` family of methods can be only called from `MainThread`.
Here is the test code:
struct PlayerViewModelTest {
@Test func testInit_shouldPopulateTable_withEmpty() async throws {
// Arrange
let disposeBag = DisposeBag()
var expectedSongTableCellViewData: [SongTableCellViewData]?
// Act
let sut = PlayerViewModel(provideAllSongs: { return .just(mockSongList) },
provideSongByArtist: { _ in return .just(mockSongList) },
disposeBag: disposeBag)
sut.populateTable
.drive(onNext: { expectedSongTableCellViewData = $0 })
.disposed(by: disposeBag)
// Assert
#expect(expectedSongTableCellViewData != nil, "Should emit something so it should not be nil")
#expect(expectedSongTableCellViewData!.isEmpty, "Should emit empty array")
}
}
This never happen in XCTest. So I assume Swift Testing is not being run in the main thread? How do I fix this?
Thanks
My app works perfectly the first time it is used but when returning to the start after playing the game and playing another it does some random things.
I figure it is because the app still retains the previous game in it’s memory allocation?
My question is, what is the best way programmatically to have an app start fresh and not have to quit it and open it again?
I'm working on an iOS/iPadOS app and need to determine programmatically whether the device is a Shared iPad as configured through Apple School Manager (ASM).
Shared iPads allow multiple users to sign in with Managed Apple IDs and are typically used in educational environments. I want to identify this configuration at runtime within my app.
I’ve looked into UIDevice, NSProcessInfo, and MDM-related APIs but haven't found a reliable way to detect whether the current device is a Shared iPad.
Is there an API or method to check if the current iPad is configured as a Shared iPad (via ASM)?
Any guidance or code examples would be appreciated.
Dear Apple Support Team,
I am writing to request clarification regarding paid service eligibility for my iPhone 14 Pro outside its original country of purchase.
Here are the details of my device:
Model: iPhone 14 Pro
Serial Number: J346337TKY
Purchase Date: December 2022
Current Location: Astana, Kazakhstan
Warranty Status: Expired
I recently visited an Apple Authorized Service Provider in Kazakhstan, and I was informed that my device could not be accepted for repair due to regional restrictions, even on a paid basis.
I would appreciate your assistance in confirming whether my device qualifies for paid repair service in Kazakhstan, or if it is strictly limited to service in its country of origin. If not eligible, could you please advise on the nearest country or region where I can receive authorized service?
Looking forward to your guidance on the next steps.
Best regards,
Ruslan D
Topic:
Community
SubTopic:
Apple Developers
when I receive calls on my mobile number and I am connected to a Wifi, the calls is cancelled after the second ring and the caller receives a busy signal. That means I cannot receive calls anymore.
This problems happens with different mobile providers and does not occur on my Samsung Galaxy Phone with the same number (eSim).
Even when I disable WIFI Calling the problem persists, when I am connected to a WIFI.
Only when I disable the WIFI Connect and I am only connected to the mobile carrier, the calls go throuhg in a normal way.
VERY annoying and hast not been fixed with Beta 3 of iOS 18.4.
Any clue how this can be solved with settings?
Hope Apple fixes this very soon!
Topic:
Community
SubTopic:
Apple Developers
I want to install tesseract in order to get OCR feature in ChatGPT.
Tesseract install requires the use of HomeBrew on macOS
But I am using macOS 15.5 and the version of HomeBrew is not compatible.
When tying to install Tasseract, old version of HomeBrew is detected and HomeBrew starts updating automatically.
The process goes fine until the download of the jpegsrc.v9d.tar.gz component. SHA256 mismatch is detected and the update process stops.
But the downloaded jpegsrc.v9d.tar.gz doesn't seem to be corrupted. Maybe an error of the expected SHA256?
Any help is welcome that would enable me to complete the HomeBrew update process.
Many thanks in advance for your support.
------------------------------ This is what I get in Terminal:
Error: Could not find an SDK that supports macOS 15.5.
You may have have an outdated or incompatible CLT.
Homebrew found the following SDKs in the CLT install:
10.14
10.15
Please update CLT or uninstall it if no updates are available.
Error: Git must be installed and in your PATH!
Warning: Sorry, Homebrew does not support your computer's CPU architecture!
Warning: You are using macOS 15.5.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this pre-release version.
==> Downloading https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
Already downloaded: /Users/bertrand/Library/Caches/Homebrew/downloads/ff08930ce8165de0173c4a8704a407636908779978246b3116202642460aca15--autoconf-2.69.tar.gz
==> Downloading https://ftp.gnu.org/gnu/autoconf-archive/autoconf-archive-2019.01.06.tar.xz
Already downloaded: /Users/bertrand/Library/Caches/Homebrew/downloads/dca2c1298b729faa88ef51d6d6218fb82ed143da108475073e0c0a9bfae091c6--autoconf-archive-2019.01.06.tar.xz
==> Downloading https://ftp.gnu.org/gnu/automake/automake-1.16.2.tar.xz
Already downloaded: /Users/bertrand/Library/Caches/Homebrew/downloads/de80077d29bb43dc673536d714b2345d6a9753a170151e730bccf02f102ecf57--automake-1.16.2.tar.xz
==> Downloading https://github.com/Homebrew/formula-patches/raw/e5fbd46a25e3566305929683356
Already downloaded: /Users/bertrand/Library/Caches/Homebrew/downloads/5a220d4e315a1ffbc9644d2bf91fe956c5a84a11689cbb8da50106ad3b71c48f--dynamic_lookup-11.patch
==> Downloading https://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz
Already downloaded: /Users/bertrand/Library/Caches/Homebrew/downloads/a7871392bebba3d24e9db265409485330a2e81ca638579ca84ff5bf9f9040666--libtool-2.4.6.tar.xz
==> Downloading https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
Already downloaded: /Users/bertrand/Library/Caches/Homebrew/downloads/5bdbf3b3fdadaf72744884b98b74a2ff887bd63a20b246f811a222a146ad7b64--pkg-config-0.29.2.tar.gz
==> Downloading https://sourceforge.net/p/giflib/bugs/_discuss/thread/4e811ad29b/c323/attac
Already downloaded: /Users/bertrand/Library/Caches/Homebrew/downloads/96a5fa155b0ad1a98cc4d577b7806eedfadcde973df641a6e90cf257b08e3598--Makefile.patch
==> Downloading https://downloads.sourceforge.net/project/giflib/giflib-5.2.1.tar.gz
Already downloaded: /Users/bertrand/Library/Caches/Homebrew/downloads/516725ea41ab2e3e2e554c736ec0ef0e0d7fcb52e597a831e2398422843276bd--giflib-5.2.1.tar.gz
==> Downloading https://www.ijg.org/files/jpegsrc.v9d.tar.gz
Already downloaded: /Users/bertrand/Library/Caches/Homebrew/downloads/23faa446d5ad2c8f0a288f26af4c4f70666394f107eb58154ab432da5f6705d1--jpegsrc.v9d.tar.gz
Error: SHA256 mismatch
Expected: 99cb50e48a4556bc571dadd27931955ff458aae32f68c4d9c39d624693f69c32
Actual: 2303a6acfb6cc533e0e86e8a9d29f7e6079e118b9de3f96e07a71a11c082fa6a
Archive: /Users/bertrand/Library/Caches/Homebrew/downloads/23faa446d5ad2c8f0a288f26af4c4f70666394f107eb58154ab432da5f6705d1--jpegsrc.v9d.tar.gz
To retry an incomplete download, remove the file above.
Topic:
Community
SubTopic:
Apple Developers
Good day.
Friends, please help.
I installed iOS 26 Betta version.
During the update, there was a power surge and the Internet went out. The download was difficult but it went through. Now I can't check for updates. Write connection error and checking for updates.
I can't roll back to 18.5.
It gives an error through the computer.
Please help.
Thank you in advance.
Topic:
Community
SubTopic:
Apple Developers
I have been working on telecommunication testing of ALE Softwar. Since no invite email received, I can’t unable to test in my IPhone.
there is no options to add my test app.
this that app url
https://apps.apple.com/in/app/ale-softphone/id1588713865
Topic:
Community
SubTopic:
Apple Developers
I'm working on a tvOS application that plays video content using TVMLKit/TVJS. I'm trying to integrate Google IMA SDK to show pre-roll, mid-roll, and post-roll ads in my app.
Here’s what I’ve done so far:
Video playback is handled through JavaScript in application.js.
Ads are managed in Swift using Google IMA SDK.
I use the evaluateJavaScript bridge to control video playback from Swift.
I pause and resume the TVJS player (Player object) using a function like startPlayingVideo(value) from Swift based on the ad lifecycle.
Current Flow:
When the video is about to start, I call loadAds() from JS.
This presents a Swift ViewController that handles IMA ad requests.
On adsManagerDidRequestContentPause, I pause the video using JS via the bridge.
On adsManagerDidRequestContentResume, I resume the video.
The Issue:
This setup doesn't behave consistently:
Sometimes the ad plays in the background and video started playing as well but can not see the ad.
Not able to see the post-roll ads
Relevant Code Snippets:
application.js
function startPlayingVideo(value) {
if (playerReference != undefined) {
if (value == true) {
playerReference.play();
else {
playerReference.pause();
}
}
}
function playVideo(videoURL) {
setup playerReference, push mediaItem, etc.
loadAds();
player.present();
}
AppDelegate.swift
let loadAds: @convention(block) () -\> Void = {
DispatchQueue.main.async {
let adManagerVC = ViewController()
AppDelegate.tvController?.navigationController.present(adManagerVC, animated: true)
}
}
let updateVideoPlayTime: @convention(block) (Double) -\> Void = { time in
CustomContentPlayhead.shared.currentTime = TimeInterval(time)
}
ViewController.swift
func adsManagerDidRequestContentPause(\_ adsManager: IMAAdsManager) {
showAdUI()
playerViewController.player?.pause()
}
func adsManagerDidRequestContentResume(\_ adsManager: IMAAdsManager) {
hideAdUI()
// Expecting JS video to resume via bridge
}
And yeah my IMSDK Implementation is working fine if I am using it with swift AVPlayer.
What I Need Help With:
Best practice for coordinating video playback between JS (Player) and Swift (IMAAdsManager).
How can I sync the playhead reliably between JS and Swift?
Is there a better way to pause/resume TVJS player from Swift during ad lifecycle?
How to reliably insert mid-roll ads when the playback is primarily controlled in JS?
Any insights, code examples, or recommended architecture improvements would be greatly appreciated!
I use DeviceActivityCenter to monitor app usage.
For DeviceActivityEvent, I set 30 events, and the threshold of each event increases by 2 minutes:
var events: [DeviceActivityEvent.Name: DeviceActivityEvent] = [:]
for index in 0..<30 {
let threshold = (index == 29)
? DateComponents(hour: 1)
: DateComponents(minute: (index + 1) * 2)
let name = DeviceActivityEvent.Name("\(prefix)|\(index)")
events[name] = DeviceActivityEvent(applications: tokens, threshold: threshold)
}
After reaching the last DeviceActivityEvent, I will restart directly in DeviceActivityMonitor
private func restartMonitoring(activity: DeviceActivityName) {
let center = DeviceActivityCenter()
let currentEvents = center.events(for: activity)
do {
try center.startMonitoring(activity, during: schedule, events: currentEvents)
} catch {
print("Fail: \(error)")
}
}
But I found that after restarting, DeviceActivityEvent will be automatically executed even if I don't use the app.
My iOS version is 18.5
So recently, last week, ive updated to the Dev Beta of ios 26. This began the very issue of my cellular data. I woke up to a warning symbol where my cellular bars should be, telling me there was something wrong with my antenna or carrier when in reality there was no problem with any of those problems and took up about 53% of my storage. This is absolutely insane and unacceptable.
Topic:
Community
SubTopic:
Apple Developers