When I run the code below, a lot of strange errors are output to the console. If you read them, you will notice that they are all referred to some "database" and "retrieving thubnail". I guessing it's somehow linked with non ordinary type of document i tried to share (Excel sheet). Is there any hint how can i avoid this mess or maybe solve the problem?
Console output:
2021-12-11 02:01:40.253894+0300 dia[964:95878] [Fetching] LPFileMetadataProviderSpecialization failed to retrieve a thumbnail from QuickLookThumbnailing (Error Domain=QLThumbnailErrorDomain Code=0 "Could not generate a thumbnail")
2021-12-11 02:01:40.267006+0300 dia[964:95858] [default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
2021-12-11 02:01:40.267062+0300 dia[964:95858] [default] Attempt to map database failed: permission was denied. This attempt will not be retried.
2021-12-11 02:01:40.267105+0300 dia[964:95858] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
2021-12-11 02:01:40.268634+0300 dia[964:95858] [default] -imageForImageDescriptor: can do IO please adopt -imageForDescriptor: for IO free drawing or -prepareImageForDescriptor: if IO is allowed. (This will become a fault soon.)
2021-12-11 02:01:40.276320+0300 dia[964:95858] Metal API Validation Enabled
2021-12-11 02:01:40.512236+0300 dia[964:95858] [default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
2021-12-11 02:01:40.512331+0300 dia[964:95858] [default] Attempt to map database failed: permission was denied. This attempt will not be retried.
2021-12-11 02:01:40.512396+0300 dia[964:95858] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
2021-12-11 02:01:40.512597+0300 dia[964:95858] [default] -imageForImageDescriptor: can do IO please adopt -imageForDescriptor: for IO free drawing or -prepareImageForDescriptor: if IO is allowed. (This will become a fault soon.)
2021-12-11 02:01:40.518850+0300 dia[964:95858] [LayoutConstraints] Changing the translatesAutoresizingMaskIntoConstraints property of a UICollectionReusableView that is managed by a UICollectionView is not supported, and will result in incorrect self-sizing. View: <_UIActivityContentFooterView: 0x1021589b0; baseClass = UICollectionReusableView; frame = (20 482.5; 374 52); layer = <CALayer: 0x28133d660>>
My full code:
import SwiftUI
import UIKit
struct export: View {
@State private var isPres: Bool = false
@State private var isLoad: Bool = true
@State private var path: [Any] = []
var anatomy = Anatomy()
var body: some View {
ZStack {
VStack {
ScrollView {
HStack {
Button(action:{
isLoad.toggle()
Task {
path.removeAll()
path.append(try await anatomy.generate())
DispatchQueue.main.asyncAfter(deadline: .now() + 0.20) {
isLoad.toggle()
}
}
isPres.toggle()
}){
VStack{
Image("menu_xlsx")
Text("Показать данные в \n таблице").foregroundColor(Color.black).multilineTextAlignment(.center)
}
}
.sheet(isPresented: $isPres) {
ShareSheet(activityItems: path)
}
Button(action:{}){
VStack{
Image("menu_mail")
Text("Отправить данные \n врачу").foregroundColor(Color.black).multilineTextAlignment(.center)
}
}
}.padding(.top)
}
Spacer()
}
if !isLoad {
ProgressView()
.progressViewStyle(.circular)
.scaleEffect(2.5)
}
}
.navigationBarTitle("Экспорт данных")
}
}
struct ShareSheet: UIViewControllerRepresentable {
// typealias Callback = (_ activityType: UIActivity.ActivityType?, _ completed: Bool, _ returnedItems: [Any]?, _ error: Error?) -> Void
let activityItems: [Any]
let applicationActivities: [UIActivity]? = nil
// let excludedActivityTypes: [UIActivity.ActivityType]? = nil
// let callback: Callback? = nil
func makeUIViewController(context: Self.Context) -> UIActivityViewController {
let controller = UIActivityViewController(
activityItems: activityItems,
applicationActivities: applicationActivities)
// controller.excludedActivityTypes = excludedActivityTypes
// controller.completionWithItemsHandler = callback
return controller
}
func updateUIViewController(_ uiViewController: UIActivityViewController, context: Self.Context) {
// nothing to do here
}
}
struct export_Previews: PreviewProvider {
static var previews: some View {
export()
}
}