我创建了这个名为createTeams()
的函数,它正在为表创建数据。
func createTeams() {
let team1 = teams(Team1: "Chelsea", Team2: "Arsenal" , startTime: "15/06/2019", location: "London")
let team2 = teams(Team1: "Barcelona", Team2: "Manchester" , startTime: "16/06/2019", location: "London")
let team3 = teams(Team1: "Real Madrid", Team2: "FC Bayern" , startTime: "17/06/2019", location: "London")
let team4 = teams(Team1: "Chelsea", Team2: "Juvantis" , startTime: "18/06/2019", location: "London")
let team5 = teams(Team1: "LiverPool", Team2: "FC Dallas" , startTime: "19/06/2019", location: "London")
let team6 = teams(Team1: "Atlanta FC", Team2: "NewCastle Utd." , startTime: "20/06/2019", location: "London")
teamsList.append(team1)
teamsList.append(team2)
teamsList.append(team3)
teamsList.append(team4)
teamsList.append(team5)
teamsList.append(team6)
}
我在viewDidLoad
中调用此函数,它工作正常。
但是,我在print
中有这个viewDidLoad
声明不起作用。
override func viewDidLoad() {
super.viewDidLoad()
print("Awake");
self.createTeams()
tableView.dataSource = self
tableView.delegate = self
}
我甚至有一个简单的打印语句按钮也无法正常工作。
@IBAction func subscribeButtonClicked(_ sender: UIButton) {
print("Subscribe Button Clicked")
if(isSubscribed) {
print("User Subscribed to this ");
isSubscribed = false
} else {
print("User Unsubbed");
isSubscribed = true
}
}
编辑:这是我正在开发的watchKit项目所以它从手表界面加载并从那里打印,以便打印那些我必须在iPhone模拟器上单独运行项目的语句
问题是有时xcode调试器由于某些内部不一致或其他原因而崩溃。所以我们编写的print语句无法在调试器窗口中显示。
您需要执行以下步骤:
它会工作正常。