Skip to content

Fix loadSwiftData fileExists path / URL-string mismatch#7

Open
ShoootingStaR693 wants to merge 1 commit into
Mcrich-LLC:mainfrom
ShoootingStaR693:fix/loadswiftdata-fileexists
Open

Fix loadSwiftData fileExists path / URL-string mismatch#7
ShoootingStaR693 wants to merge 1 commit into
Mcrich-LLC:mainfrom
ShoootingStaR693:fix/loadswiftdata-fileexists

Conversation

@ShoootingStaR693
Copy link
Copy Markdown

SDWallpaperVideo.videoURL / .previewImage are stored as
URL.absoluteString (file://…), but loadSwiftData() checked them
with FileManager.fileExists(atPath:), which expects a plain path.
The check always returned false, so every launch entered the recovery
branch and read the @Attribute(.externalStorage) video / thumbnail
properties. Effects:

  1. Application Support fills up with duplicate .mov / .png per launch.
  2. Touching @Attribute(.externalStorage) on every launch exposes the
    app to a CoreData NSException (_PFRoutines readBytesForExternalReferenceData:
    _crashOnException) whenever an external blob is missing or
    unreadable.

Fix: extract URL.path from the stored string before fileExists.

@ShoootingStaR693 ShoootingStaR693 force-pushed the fix/loadswiftdata-fileexists branch from 23b53f1 to 2b21404 Compare May 16, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant