SwiftUI Document-based apps crash in iOS 18

I am trying to integrate the new iOS 18 document launching experience with my app, but opening or saving files fails with the RC version of Xcode 16. The error I receive is "Publishing changes from background threads is not allowed."

I downloaded Apple's new sample code ("Writing app"), and it fails with the same error.

Is there an easy fix for this?

Answered by Engineer in 803611022

Hello @j.blake.harris, I believe you are referring to the Building a document-based app with SwiftUI sample code project. Please use Feedback Assistant to submit a bug report and post here your bug report's ID. When testing this, I was able to reproduce the issue on the iOS 18 Simulator app, but not on a device running the iOS 18 developer beta, or on Sonoma when I select the macOS target.

Accepted Answer

Hello @j.blake.harris, I believe you are referring to the Building a document-based app with SwiftUI sample code project. Please use Feedback Assistant to submit a bug report and post here your bug report's ID. When testing this, I was able to reproduce the issue on the iOS 18 Simulator app, but not on a device running the iOS 18 developer beta, or on Sonoma when I select the macOS target.

I am also experiencing issues with a document based app. My app can open and pull apart .ips crash files, or at least that is the new feature I wanted to launch next week.

When I share an .ips file from the Settings app on iOS 17.6.1, it works just fine. When I do the same on either iOS 18 RC or iPadOS 18 RC, my app icon shows in the suggested list of apps to share to, but when I select my app it does nothing.

Interestingly, I can still share the file to the Files app, and from there when I use the Files app's share sheet, I can successfully launch and trigger my app to grab the data.

FB15131454 - Settings: PRODUCTION ISSUE - Sharing an ips file from device analytics does not open my app on iOS and iPadOS 18 RC, works on iOS 17.6.x

*** suggested by @Engineer for completeness, I modified the WritingApp code to support iOS 17 by conditionally compiling all of the views, changing the extension supported to ips and ran it on my iPhone running 17.6.1. While the app doesn't actually do anything with the file, it successfully launches my app from Settings > Analytics. Taking again, the same sample code with modifications, running it on 18 RC, it does not launch the sample application.

Feedback assistant bug report ID: FB15133758

Thanks.

SwiftUI Document-based apps crash in iOS 18
 
 
Q