Reputation:
I have created this function called createTeams()
which is creating data for the table.
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)
}
I call this function in viewDidLoad
and it works fine.
However, I have this print
statement in viewDidLoad
that doesn't work.
override func viewDidLoad() {
super.viewDidLoad()
print("Awake");
self.createTeams()
tableView.dataSource = self
tableView.delegate = self
}
I Even have this button with a simple print statement that is not working either.
@IBAction func subscribeButtonClicked(_ sender: UIButton) {
print("Subscribe Button Clicked")
if(isSubscribed) {
print("User Subscribed to this ");
isSubscribed = false
} else {
print("User Unsubbed");
isSubscribed = true
}
}
Edit: It is a watchKit Project i am developing so it was loading from the watch Interface and printing from there in order to print those statements i had to run the project on a iPhone simulator individually
Upvotes: 6
Views: 5989
Reputation: 276
Another possibility is the console icon in the lower right corner has been flipped accidentally. If you don't use these icons much, its easy to forget about them. This was the case for me.
Upvotes: 0
Reputation: 103
So after doing a lot of research and following the previous steps mentioned about the console not showing it turned out that I've hid the console area or deactivated it. To activate/show it :
or simply click command+shift+c
Upvotes: 12
Reputation: 2419
The problem is sometimes xcode debugger crashed due to some internal inconsistency or for other reasons. So what we write print statements cannot be shown in debugger window.
You need to do these steps:
Clean the xcode.
Force quit the xcode.
Clean the derieved data.
Restart the xcode and run it.
It will work fine.
Upvotes: 2