无法根据成员推断上下文基础。

发布于 01-21 01:05 字数 792 浏览 5 评论 0原文

我正在尝试按照这个有关构建 Apple Watch 应用的截屏视频 。我已将 Xcode 更新到 13.3,但收到的错误并未出现在截屏视频中。

无法推断引用成员“fractionLength”的上下文基数

无法推断引用成员“数字”的上下文基础

调用中的额外参数“numberFormat”

Text(
    Measurement(
        value: 47,
        unit: UnitEnergy.kilocalories
    ).formatted(
        .measurement(
            width: .abbreviated,
            usage: .workout,
            numberFormat: .numeric(precision: .fractionLength(0))
            )
        )
    )

在此处输入图像描述

I'm trying to follow this screencast on building an app for Apple Watch. I've updated Xcode to 13.3, but I'm getting an error that doesn't appear in the screencast.

Cannot infer contextual base in reference to member 'fractionLength'

Cannot infer contextual base in reference to member 'numeric'

Extra argument 'numberFormat' in call

Text(
    Measurement(
        value: 47,
        unit: UnitEnergy.kilocalories
    ).formatted(
        .measurement(
            width: .abbreviated,
            usage: .workout,
            numberFormat: .numeric(precision: .fractionLength(0))
            )
        )
    )

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

背叛残局2025-01-28 01:05:53

也许情况发生了变化。您可以尝试一下:

Text(Measurement( value: 47, unit: UnitEnergy.kilocalories)
        .formatted(
            .measurement(
                width: .abbreviated,
                usage: .workout,
                numberFormatStyle: .number.precision(.fractionLength(0))
            )
        )
)

maybe things have changed. You could try this instead:

Text(Measurement( value: 47, unit: UnitEnergy.kilocalories)
        .formatted(
            .measurement(
                width: .abbreviated,
                usage: .workout,
                numberFormatStyle: .number.precision(.fractionLength(0))
            )
        )
)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文