Module 3 - Lesson 8 - Debugging Activity Solutions


Really been enjoying following these lessons - from knowing nothing at all i feel i have a decent grasp with things now!

i am wondering where the solutions are for the De-Bugging tutorial? i cant find anything!

the sheet mentions teachable but i cannot find that anywhere!


Hi @LM_Live,

Welcome to the community!

Look at the top of the Module, Materials for the course. All the materials can be found there.


I’m not able to find the activity solutions in the Materials folders either. For this lesson, here’s what I found in the dropbox below. Can you pls let me know where the solutions are in here? Thanks.

The associated project contains the bug and the ReadMe.txt file explains what the bug does. Part of the challenge is to find the error and fix it yourself. The later project files do not contain these bugs of course but there is no video explaining what the solutions are.

Activity 1
You can see that the background of the collectionView behind the cards is black. You may not recall the earlier setup process of configuring the cell layout in storyboard, but that was covered so that the background image can be seen through the collectionView.

Hint: Have a look at the settings for the collectionView background property.

Activity 2
There are 17 cards instead of 16 when you run the App. This is a sneaky bug and it is related to the getCards() method in the class CardModel in the file CardModel.swift.

Hint: Go back to Lesson 4 on the Custom Classes setup and watch closely while referring to the code with the bug in it.

Activity 3
When you run the App the some of the cards when flipped reveal a card that is blank. This is a sneaky bug but you should be able to figure it out by going over the code that creates the set of 8 pairs of cards since that is where the bug is. The interesting thing about this bug is that the program lets you match blank cards which makes sense when you understand the code with respect to how it is comparing the tow cards to determine if they are the same. Once you find the bug it will all make sense.

Same hint as the previous Activity.

Hi Chris - thanks for those tips. I was able to test my solutions on activities 1 & 2 but for some reason, the Activity 3 proj will not build. In the activity 3 proj file, I see these same account and profile issues as in the activity 1 & 2 files. But in the activity 1 & 2 files, they are only yellow triangle warnings and the programs still build successfully. But for some reason, these same account and profile issues are noted as red errors on the activity 3 file and the program build fails. I’m running these on Xcode v12.3. please let me know if you might have any tips on making this activity 3 file run. Thanks for your help. Ida


Those account errors in red are caused by the project still populated with the Developer Account details belonging to Chris Ching when he created the project.

You can simply select none from the Team drop down menu and still run the Code on a simulator.

If you attempt to run the code to a real device then you may have an issue by not have your own developer account.

Hi Chris - thank you for that suggestion. It is still not letting me run the project as the build still fails unfortunately.
In any case, all the best for 2021! Ida