V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
工单节点使用指南
• 请用平和的语言准确描述你所遇到的问题
• 厂商的技术支持和你一样也是有喜怒哀乐的普通人类,尊重是相互的
• 如果是关于 V2EX 本身的问题反馈,请使用 反馈 节点
lipyoung
V2EX  ›  全球工单系统

AWS 的 amplify codegen 自动生成的 API. Swift 文件属性不完整

  •  
  •   lipyoung · 2019-11-29 10:59:18 +08:00 · 2088 次点击
    这是一个创建于 1581 天前的主题,其中的信息可能已经有所发展或是发生改变。

    bug 描述 我使用了 AWS 的 AppSync 做后台开发。使用 amplify codegen 指令会自动生成 API.swift 文件,里面的属性能正常被 iOS 端使用,但是嵌套的属性无法访问。

    重现步骤

    1. 自定义 schema 文件:
    type Comment {
    	id: ID!
    	content: String
    }
    type Query {
    	getTodos(limit: Int, nextToken: String): TodoConnection
    	getTodo(id: ID, title: String): Todo
    }
    type Todo {
    	id: ID!
    	title: String
    	comments: [Comment]
    }
    type TodoConnection {
    	todos: [Todo]
    	nextToken: String
    }
    schema {
    	query: Query
    }
    
    1. 使用 amplify codegen 指令
    2. 使用 API.swift iOS 端文件
    3. 无法读取嵌套属性内容

    期望 我希望 iOS 端能使用嵌套的属性。 This is swift code:

    1. let todoComment = GetTodoQuery.Data.GetTodo.Comment(id: "id", content: "content")
    2. print(todoComment.content)
            
    3. let todosComment = GetTodosQuery.Data.GetTodo.Todo.Comment
    4. print(todosComment.content)
    

    第 3 行和第 4 行就是错误的。没办法访问到嵌套的数组里面的内容。因为自动生成的API.swift里面没有。但是非嵌套就能访问到。真是服了

    环境

    • pod 'AWSCore', '2.11.1'
    • pod 'AWSAppSync', '2.14.3'

    补充内容 我来试一下名声在外的全球工单系统,我 2 天前给 AWS iOS SDK 的 github 仓库提交了 BUG,根本没有人理我 😭。现在不能访问数组里面的属性,我自己写的项目搞的很难受。求助懂 AWS amplify 和 iOS 端的大神出来救援一下

    1 条回复    2019-11-29 11:00:49 +08:00
    lipyoung
        1
    lipyoung  
    OP
       2019-11-29 11:00:49 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2712 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 15:41 · PVG 23:41 · LAX 08:41 · JFK 11:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.