【问题标题】:Use of undeclared type - Swift - AWS Amplify使用未声明的类型 - Swift - AWS Amplify
【发布时间】:2019-03-22 21:58:36
【问题描述】:

我正在研究此处发布的优秀示例应用程序:

https://github.com/aws-samples/aws-mobile-appsync-events-starter-ios/tree/master/EventsApp

在第 28 行重新创建 EventDetails.swift 时出现错误:“使用未声明的类型...”:

var event: Event?

我正在使用不同的架构和数据类型重新创建示例应用程序。我不知道 Event 数据类型在哪里定义,因此我不知道在哪里/如何创建等效数据类型。我的情况是,我正在使用“商店”而不是“事件”。当我用“Store”代替“Event”时,我得到了上面提到的错误。感谢您的帮助。

这里是 schema.graphql 文件:

type Store @model {
id: ID!
name: String!
number: String!
street_address: Stringx
city: String
state: String
zip_code: String
}

【问题讨论】:

  • 可能您在创建数据类型时犯了一个错误。我认为您应该从自己的代码中显示更多细节。
  • @AhmetSinaUstem 我添加了 schema.graphql 文件。这有帮助吗?

标签: swift xcode aws-amplify


【解决方案1】:

没有这样的类型

字符串x

您用于 street_address。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多