Do not use quotes in HTML code
So I sent my day tracking down a bug that was causing our app to break. After updating Xcode, Baker and everything I could possibly think of, I found out that I had accidentally used quotes around one word in my HTML by pasting text directly into the code instead of using the proper quote code. So for anyone else getting uncaught exceptions in Baker, check your HTML first. Oddly enough, I swear I had used quotes before without problems.
Here is the error log from xCode
Pages in this book: 15 2012-03-31 15:28:10.308 Baker[330:707] Starting page: 1 2012-03-31 15:28:10.312 Baker[330:707] • Init page details for the book pages 2012-03-31 15:28:10.431 Baker[330:707] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: nil argument' *** First throw call stack: (0x3632288f 0x37577259 0x36322789 0x363227ab 0x377de3f3 0x377dec5b 0xfe3d 0xfd61 0x5877 0x6d21 0x3d0d 0x2df3 0x30fcfe53 0x30fc9985 0x30f97c6b 0x30f9770f 0x30f970e3 0x3263922b 0x362f6523 0x362f64c5 0x362f5313 0x362784a5 0x3627836d 0x30fc8a13 0x30fc5e7d 0x2d7b 0x2d2c) terminate called throwing an exception
If anyone cares, the line of text causing the problem was “Bugs!” Ironic, I know.
That might be the first case of a self-reporting bug that I see ;)
Seriously though, thanks for sharing this. I think you've stumbled into an encoding issue: those quotes are probably not supported in the page character set.
The ones you used successfully in the past were probably standard ASCII quotes, such as " " (as opposed to “ ”, which you usually get when pasting from another application such as Word).
I've never spent 5 hours chasing down a bug before. I suppose there is always a first time. I literally did everything I could until I finally went through the offending HTML page line by line deleting stuff until it stopped. At least we now know what error message comes up (well, it might also come up for other reasons, but at least people have a starting place).
This error came up a few more times for me while I was getting our app ready. Although it was not always clear what was causing it, it always related to something in the HTML. I'm closing the issue as it doesn't seem to have anything to do with Baker specifically, but for others who get the same error, be sure to check your code even if it looks correct. A good way to isolate it is to delete pages from your book.json file until Baker starts working. Baker guys, is there a better way to isolate the problem page? Can Baker specify which page is causing the error? This took me forever to track down because I couldn't figure out which page was causing it.
I've been trying to reproduce this in the simulator, but haven't got anywhere. The quotes are not displayed correctly in the page, but the app is not crashing.
I will check and see if I have any copies of some old HTML that was causing it and will try and post it to see if it breaks for anyone else.