我试图将ILTItem变量传递到我的ILTViewController,当用户通过深层链接启动我的应用程序时,由AppDelegate.swift触发。无法调用非函数类型字符串的值
的代码我有错误:
不能调用非功能型“字符串”
在哪里,我定义ilt
行的价值。
这是我目前所面对的代码:
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
var ilt = ILT(homeworkID: 1234, title: "History ILT", subject: "History", teacher: "Miss A Smith", teacherCode: "asmith", studentID: 12345, description: "Description....", due: 1450137600, status: "In Progress", hasAttachments: true)
var newVC = ILTViewController()
newVC.ILTitem = ilt
appDelegate.window?.addSubview(newVC.view)
为什么会这样?在我ILTViewController I类有:
class ILTViewController: UIViewController {
// accept the incoming ILT struct
var ILTitem: ILT!
ILT结构声明:
struct ILT {
let homeworkID: Int
let title: String
let subject: String
let teacher: String
let teacherCode: String
let studentID: Int
let description: String
let due: Double
let status: String
let hasAttachments: Bool
}
安置自己的'ILT'类声明 – redent84
@我将它redent84 – James
你的代码工作正常:HTTP:// swiftstub.com/580271845。你可能已经在其他地方声明了一个名为'ILT'的String变量,这就是为什么它失败了。 – redent84