gpt4 book ai didi

ios - Swift 字典包含值但未打印在调试器控制台上

转载 作者:行者123 更新时间:2023-11-28 13:44:00 25 4
gpt4 key购买 nike

我正在这样的字典中创建和打印值

let answersToSubmit = SubmitAnswerModel() //main model
let realm = try! Realm()
let savedExamResponse = realm.object(ofType: SavedExamResponse.self, forPrimaryKey: id)
answersToSubmit.uniqid = savedExamResponse?.uniqueId

var answerListToSubmit = [QuestionAnswersToSubmit]()

for item in (savedExamResponse?.questionAnswerList)! {
let answerToSubmit = QuestionAnswersToSubmit()
answerToSubmit.qid = item.questionId
answerToSubmit.value.append(item.selectedOption)
answerListToSubmit.append(answerToSubmit)

}

answersToSubmit.answers = answerListToSubmit
print("length %s ",answersToSubmit.answers.count)//this is printing 100
print("answers to submit %s",answersToSubmit)//this is printing only the first part

输出是这样的

length %s  100
answers to submit %s SubmitAnswerModel {
uniqid = test-5cb2f6a2d81034.66536499;
//the rest of the object needs to printed here, isn't it
}

所以我不太确定我是否附加了数组并将其放入字典中。任何帮助,将不胜感激。谢谢

最佳答案

如果您想要更全面的日志输出,请尝试使用 dump() 函数:

dump(answersToSubmit)

这会向控制台打印更多信息。

关于ios - Swift 字典包含值但未打印在调试器控制台上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55674208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com