Chapter 4: Beginning Message Apps


I have added Dynamic Stickers code and Ie the following issue: The first time I switch on Chocoholic Mode the filter is not applied and I see all candy. When I switch off and switch on again then it works OK. I have debugged the code and the filter and map is done well, but when I reload the data it does nothing the first time. Am I doing something wrong?

I stumbled into the solution. I don’t understand why, but in the completed project file the stickerNames array is declared above the class declaration. It will run in or out of the class declaration, but the code only does what it’s supposed to when it’s outside. That’s not explicitly mentioned in the tutorial.