The error message is perfectly clear. You're not allowed to nest functions. Part of learning to code is learning to interpret error messages. I'm not an Objective-C programmer, but I still understand what that means.
If you're getting errors typing in the code compared to copy and pasting, you're obviously not typing it in correctly. It must be exactly the same.
I've already corrected it. Move the final } to before the boolString function.
If that's not clear ... go to the end of the file, to the last }. Delete it. Go to the line before the boolString function. Add }. Recompile. That doesn't mean the code is correct. It might just fix this particular error and produce another error. As I said, I'm not an Objective C programmer, so I can't compile what you have in my head.
Edit: Googling for "fnested-functions" gives this as the first result:
http://developer.apple.com/mac/library/technotes/tn2006/tn2161.html
Read and try to understand.
Edit 2: Actually, the second result is likely more useful:
https://forums.macrumors.com/threads/653636/