Skip Navigation


There's not much here at the moment... I finished Apple's Currency Converter tutorial and Aaron Hillegass' RandomApp. It looks like I'll have to dig into Objective C and read The Objective-C Programming Language. Be back in a few years...


Monday, November 24, 2003

I finished RandomApp from Cocoa Programming for Mac OS X by Aaron Hillegass. Not exactly like the book, but no problems, either.


Currency Converter

Friday, November 14, 2003

I finished Apple's Objective C tutorial where you build a little application called Currency Converter. The exercise certainly gave me a better appreciation for Cocoa, if not for Apple's documentation. I had spent a little time with Interface Builder before, but not enough to appreciate how nice it is to use when creating a GUI interface. But I had some problems. I named my files exactly as specified by the tutorial, but because the file names had spaces in them, Project Builder was unable to compile the project. This seems like a rather careless oversight in a tutorial aimed at beginners, but admittedly nowhere near as egregious as the infamous iTunes installer which could delete an entire hard disk if it happened to be named with a space.

Something else I thought strange was the results I got from running the converter. All the numerical values (the currency amount, exchange rate, and the result) are defined as "floats." I would expect, then, I could enter a decimal number and get a decimal result. If I enter 1 for both amount and exchange rate, then the result is 1, but if I change the exchange rate to 1.1, then the result is still 1! I'm definitely losing money in that exchange. If I change the amount to 1 and the exchange rate to 1.1, then the result is 1.210000038146973! Since the program is simply multiplying the exchange rate by the amount, I can't account for this. So now I have a nice GUI on top of a program that doesn't work...


Wednesday, November 19, 2003

I broke my Currency Converter project. When I opened the project a few days after finishing it, I found that I could no longer "Run" it; I could only "Build" it. The error I received after the build was "Run session cancelled: No launchable executable to run." Hmm. Yet the "launchable executable" Currency is right where it was the last time I used Project Builder, and furthermore, I can run it from the Finder just fine. What's weird, however, is that now the name has quotes around it. What's up with that, I wondered. I think I might know why.

At the end of working on the project originally, I had trouble building it. After Googling for help, I found the answer. The prefix header file, "Currency Converter_Prefix.h" has a space in its name. When Project Builder goes to build, it splits that name at the space and starts looking for two files, neither of which exist:

Missing file or directory: Currency
Missing file or directory: Converter_Prefix.h

I find it extremely annoying that Apple chose this name with no warning that there's a problem with spaces in filenames. Oh, I get it. It's a tutorial, and it's all part of the learning experience. Anyway the solution is to put quotes around the name. In my zeal, I also put quotes around the Product Name, Currency Converter, which also has a space in it. This step is not necessary and was the reason the application name had quotes around it in the Finder. What's strange is why this broke the project. For each build and run cycle, Project Builder created a product with a quoted name, but for some reason couldn't run it.

For the record, make sure you enter your "Product Name" without quotes and that the name matches the "Executable" name. If you don't change the Executable name, you should be fine. The "Product Name" field in "Settings" is the "master" field. If you change the name here, it will also change in Info.plist Entries automatically. It does not work in reverse however, so if you changed the Info.plist "Executable" name, the names would be out of synch. (Someday I hope I'll understand why there are two names.)