Coming from a Symbian background, I’m somewhat concerned about the seeming lack of error handling in Cocoa. Cocoa has many methods that, as far as I can see, have no error reporting and yet could fail.
Eg How come NSMutableString appendString has a void return type and doesn’t throw exceptions (at least the documentation doesn’t mention any)? Surely if I append a long enough string then theoretically I could run out of memory. Is it paranoid of me to check the length of the NSMutableString before and after appending to verify that the append worked?
My test is on Mac OS X and I imagine you’re talking about the iPhone platform.
The thing is I fail to see how returning an error from the appendString method would help since the platform is at that point in such a state that it can’t satisfy malloc requests for your process.
To get around the problem you can probably malloc your own address space and use this process managed memory as storage for your strings. I think Carbon’s CFString (toll free bridged to NSString) allows you to use your own memory allocator.