小编Isa*_*aac的帖子

SwiftUI 中 UIActivityViewController 出现多个错误

当我运行下面的代码时,控制台会输出很多奇怪的错误。如果您阅读它们,您会注意到它们都提到了一些“数据库”和“检索缩略图”。我猜它与我尝试共享的非普通类型文档(Excel 工作表)有某种联系。有什么提示我如何避免这种混乱或解决问题吗?

\n

控制台输出:

\n
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")\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 …
Run Code Online (Sandbox Code Playgroud)

xcode uikit ios swift swiftui

7
推荐指数
0
解决办法
3864
查看次数

DynamicTypeSize 不适用于警报和 ShareSheet

我在辅助功能设置中限制用户更大文本大小选择的新方法遇到了一些问题(通过 .dynamicTypeSize = .medium \xe2\x80\xa6 .xLarge)。当我将 DynamicTypeSize 设置为中或 xLarge 到应用程序中的所有视图(实际上是我的通用视图,称为 startPage(),其中包含一些其他子视图,例如 foodIntakePage())时,仍然有一些视图(Alert 和 ShareSheet)不\ xe2\x80\x99t 应用我的配置。因此,当用户在设置中设置 .accessibilityExtraLarge 时,我的警报和 ShareSheet 视图会增长到难以想象的大小。我该如何解决这个问题?至少将大小设置为 xxLarge,而不是 .accessibilityExtraLarge。

\n
import SwiftUI\n\n@main\nstruct diaApp: App {\n    @State public var main_font = DynamicTypeSize.xLarge\n    var body: some Scene {\n        WindowGroup {\n            startPage()\n                .dynamicTypeSize(main_font)\n                .environment(\\.defaultMinListRowHeight, 52.5)\n                .onAppear(perform: {\n                    // some rules based on UIScreen width and height to change main_font from small to xxLarge \n                })\n        }\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

我的警报如下所示:

\n
    // some button on the startPage() child (starPage -> foodIntakesPage)\n …
Run Code Online (Sandbox Code Playgroud)

xcode uikit ios swiftui

5
推荐指数
0
解决办法
185
查看次数

键盘在一张纸上

我有一个带有输入字段的基本窗口(第1页),在它的顶部出现一个弹出窗口(第2页),其中还有一个输入字段和按钮,单击时会弹出一个小窗口带有输入字段(第 3 页)。如果键盘上没有显示“Done”,则界面功能正常。如果添加一个“完成”按钮,结果是,当从第 2 页移动到第 3 页时,它的颜色从系统颜色蓝色变为灰色。实验并想知道为什么会这样,我发现第 1 页上的工具栏负责第 3 页上按钮的颜色...如果您更改第 1 页工具栏上按钮的颜色 - 它将在第 3 页工具栏上更改,第 2 页不会受到影响。此外,添加按钮会导致错误:“[LayoutConstraints] 无法同时满足约束。” 我想知道为什么在第 1 页上设置了键盘上的按钮,而在第 3 页上打字时也得到了一个按钮?为什么它变灰并且不起作用?为什么如果我更改第 1 页上的按钮的颜色,第 3 页上的灰色按钮的颜色也会更改吗?

一个具有代表性的小样本:

内容视图

import SwiftUI

struct ContentView: View {
    @State private var bloodClucoseLvl: String = ""
    @State private var isSheetShown: Bool = false
    @FocusState private var focusField: Bool
    var body: some View {
        NavigationView {
            List {
                Section("Add your current blood glucose lvl") {
                    TextField("5,0 mmol/l", text: $bloodClucoseLvl)
                        .focused($focusField)
                }
                Section("Add food …
Run Code Online (Sandbox Code Playgroud)

xcode ios swiftui

5
推荐指数
0
解决办法
207
查看次数

标签 统计

ios ×3

swiftui ×3

xcode ×3

uikit ×2

swift ×1