Isa*_*aac 7 xcode uikit ios swift swiftui
当我运行下面的代码时,控制台会输出很多奇怪的错误。如果您阅读它们,您会注意到它们都提到了一些“数据库”和“检索缩略图”。我猜它与我尝试共享的非普通类型文档(Excel 工作表)有某种联系。有什么提示我如何避免这种混乱或解决问题吗?
\n控制台输出:
\n2021-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")\n2021-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:]}\n2021-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.\n2021-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:]}\n2021-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.)\n2021-12-11 02:01:40.276320+0300 dia[964:95858] Metal API Validation Enabled\n2021-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:]}\n2021-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.\n2021-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:]}\n2021-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.)\n2021-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>>\nRun Code Online (Sandbox Code Playgroud)\n我的完整代码:
\nimport SwiftUI\nimport UIKit\n\nstruct export: View {\n @State private var isPres: Bool = false\n @State private var isLoad: Bool = true\n @State private var path: [Any] = []\n var anatomy = Anatomy()\n var body: some View {\n ZStack {\n VStack {\n ScrollView {\n HStack {\n Button(action:{\n isLoad.toggle()\n Task {\n path.removeAll()\n path.append(try await anatomy.generate())\n DispatchQueue.main.asyncAfter(deadline: .now() + 0.20) {\n isLoad.toggle()\n }\n }\n isPres.toggle()\n }){\n VStack{\n Image("menu_xlsx")\n Text("\xd0\x9f\xd0\xbe\xd0\xba\xd0\xb0\xd0\xb7\xd0\xb0\xd1\x82\xd1\x8c \xd0\xb4\xd0\xb0\xd0\xbd\xd0\xbd\xd1\x8b\xd0\xb5 \xd0\xb2 \\n \xd1\x82\xd0\xb0\xd0\xb1\xd0\xbb\xd0\xb8\xd1\x86\xd0\xb5").foregroundColor(Color.black).multilineTextAlignment(.center)\n }\n }\n .sheet(isPresented: $isPres) {\n ShareSheet(activityItems: path)\n }\n Button(action:{}){\n VStack{\n Image("menu_mail")\n Text("\xd0\x9e\xd1\x82\xd0\xbf\xd1\x80\xd0\xb0\xd0\xb2\xd0\xb8\xd1\x82\xd1\x8c \xd0\xb4\xd0\xb0\xd0\xbd\xd0\xbd\xd1\x8b\xd0\xb5 \\n \xd0\xb2\xd1\x80\xd0\xb0\xd1\x87\xd1\x83").foregroundColor(Color.black).multilineTextAlignment(.center)\n }\n }\n }.padding(.top)\n }\n Spacer()\n }\n if !isLoad {\n ProgressView()\n .progressViewStyle(.circular)\n .scaleEffect(2.5)\n }\n }\n .navigationBarTitle("\xd0\xad\xd0\xba\xd1\x81\xd0\xbf\xd0\xbe\xd1\x80\xd1\x82 \xd0\xb4\xd0\xb0\xd0\xbd\xd0\xbd\xd1\x8b\xd1\x85")\n }\n}\n\nstruct ShareSheet: UIViewControllerRepresentable {\n// typealias Callback = (_ activityType: UIActivity.ActivityType?, _ completed: Bool, _ returnedItems: [Any]?, _ error: Error?) -> Void\n\n let activityItems: [Any]\n let applicationActivities: [UIActivity]? = nil\n// let excludedActivityTypes: [UIActivity.ActivityType]? = nil\n// let callback: Callback? = nil\n \n func makeUIViewController(context: Self.Context) -> UIActivityViewController {\n let controller = UIActivityViewController(\n activityItems: activityItems,\n applicationActivities: applicationActivities)\n// controller.excludedActivityTypes = excludedActivityTypes\n// controller.completionWithItemsHandler = callback\n return controller\n }\n \n func updateUIViewController(_ uiViewController: UIActivityViewController, context: Self.Context) {\n // nothing to do here\n }\n}\n\nstruct export_Previews: PreviewProvider {\n static var previews: some View {\n export()\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
3864 次 |
| 最近记录: |