Post not yet marked as solved
Post marked as unsolved with 0 replies, 646 views
My goal is to generate a temp file with custom type, and share them to Files.
Code:
struct Issue: View {
@State var myFile : URL? = nil
var body: some View {
Button("Generate ShareLink") {
let url = FileManager.default.temporaryDirectory
.appendingPathComponent("my_file")
let data = Data([0, 1, 2, 3, 4, 5])
try? data.write(to: url)
myFile = url
}
if let f = myFile {
ShareLink(item: f) // This file can be successfully saved to Files
}
}
}
This code works but it pops a lot of warnings in console:
Failed to request default share mode for fileURL:file:///.../tmp/my_file error:Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=1608, _LSFunction=runEvaluator}
Only support loading options for CKShare and SWY types.
error fetching item for URL:file:///.../tmp/my_file :
error fetching file provider domain for URL:file:///.../tmp/my_file :
Collaboration: error loading metadata for documentURL:file:///.../tmp/my_file error:Error Domain=NSFileProviderInternalErrorDomain Code=0 "No valid file provider found from URL file:///.../tmp/my_file." UserInfo={NSLocalizedDescription=No valid file provider found from URL file:///.../tmp/my_file.}
Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.primitiveattribute AND originator doesn't have entitlement com.apple.runningboard.assertions.frontboard AND target is not running or doesn't have entitlement com.apple.runningboard.trustedtarget AND Target not hosted by originator)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.primitiveattribute AND originator doesn't have entitlement com.apple.runningboard.assertions.frontboard AND target is not running or doesn't have entitlement com.apple.runningboard.trustedtarget AND Target not hosted by originator)}>
connection invalidated
Despite of these errors, my 6 bytes file can be saved to Files.
But how can I solve these warnings?
(I ran this code in a iOS 17.0.1 simulator with Xcode 15.0.1)