小编Yut*_*uto的帖子

人脸ID评估流程无法正常运行

我正在尝试获取以下功能中的Face ID或Touch ID是否成功

func authenticate() -> Bool{

    let context = LAContext()
    var error: NSError?

    guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
        return false
    }
    var returnValue = false
    let reason = "Face ID authentication"
    context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason) 
    {
        isAuthorized, error in
        guard isAuthorized == true else {
            return print(error)
        }
        returnValue = true
        print("success")
    }
    return returnValue        
}
Run Code Online (Sandbox Code Playgroud)

但是即使此代码成功执行,它也会跳过,returnValue = true稍后再传递,导致返回错误。为什么会这样?以及如何解决此代码以使其像预期的那样工作?

上面的代码来自此链接 ,以防万一此人正在观看,谢谢。

authentication ios touch-id swift face-id

6
推荐指数
1
解决办法
2074
查看次数

SwiftUI中的导航内容

我试图弄清楚如何在SwiftUI中使用导航栏

我想将BarButtonItem图像放在NavigationBar

我已经能够显示导航栏并放置标题 在此处输入图片说明

var body: some View {
    NavigationView{
        List(0...5) { note in

            VStack(alignment: .leading) {
                Text("title")
                Text("Date")
                    .font(.subheadline)
                    .foregroundColor(.secondary)
            }

        }
        .navigationBarTitle(Text("Notes"))

    }
}
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui xcode11

4
推荐指数
2
解决办法
2967
查看次数

无法修复“无法找到或使用自动链接的库”

我有一个使用Swift和pods(firebase)构建的应用程序。我有18个三角形和100个红色错误,这些是以前没有的。它们仅在我尝试存档我的应​​用程序时出现。

我已经尝试了所有这些方法(添加搜索路径,添加空白swift文件,删除框架路径)

将Swift Static库与Objective-C项目一起使用时会出错

为什么链接器将静态库与错误链接?的iOS

ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftsimd'
ld: warning: Could not find or use auto-linked library 'swiftGLKit'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
ld: warning: Could not find or use auto-linked library 'swiftSpriteKit'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find …
Run Code Online (Sandbox Code Playgroud)

xcode ios swift

3
推荐指数
3
解决办法
1441
查看次数

无法更改 SplitViewController 中状态栏的颜色

使用 SplitViewController 时如何更改状态栏的颜色?当仅使用带有导航控制器的视图控制器时,状态栏的颜色会通过使用 \xe2\x91\xa0 自动更改。有什么方法可以自动更改状态栏吗?

\n\n

我想向我的应用程序添加深色模式,因此我无法从项目/目标设置中更改状态栏样式。

\n\n

在我的应用程序中,我有一个通知可以打开和关闭我的黑暗模式设置。

\n\n

我努力了

\n\n

\xe2\x91\xa0self.navigationController?.navigationBar.barStyle = .black

\n\n

\xe2\x91\xa1更改 info.plist

\n\n

\xe2\x91\xa2状态栏浅色内容不会出现在使用分割视图控制器的导航控制器中

\n\n

这就是它的样子,我正在使用 \xe2\x91\xa0 来更改导航栏的颜色\n

\n

uisplitviewcontroller ios swift

1
推荐指数
1
解决办法
697
查看次数