iTahDoodle Initialization


#1

After programming the iTahDoodle app in Ch 27 of Hillegass’ C-Progamming book, I discovered that the app will blow up if the user clicks on the Insert button before entering an initial string in the task window. This is because the code fails to initialize the textField string and the c-compiler defaults the string to nil (0x0000000). An easy fix to this issue is to insert the following code in the [color=#008000]didFinishLaunchingWithOptions[/color] application; specifically right after the line of code [size=100][color=#0000FF][taskField setPlaceholder:@“Type a task, tap Insert”];[/size][/color] add a line of code to initialize the taskField string to a null string – [color=#0000FF][size=100][taskField setText:@""];[/size][/color]

Enjoy :wink: