Apple pains


Two things I have to blab about. First and foremost… if you run OSX do not… under any circumstances… ever flip the executable bit on /usr/local/lib! I had this path marked non executable (think chmod a-x) for whatever reason I’ll never know. Software would run for the most part, but certain things just wouldn’t work right. My Mac had troubles that no other Mac in our organization encountered. This went on for months… ever since I got the thing. Rather than go into detail I’ll just say if you start getting weird behavior from certain software, like errors reporting missing libraries or dylibs and such… make sure this folder has been set with chmod 755. Running that one command at the advice of a Mac genius buddy of mine solved like seven hundred thirty four problems. I’ll about this problem again. then I’ll post again just to make sure the point is solidified.

Next order of business. Don’t count on, rely on, or even trust the code templates apple gives you through XCode. I just hit a snag I had hit months ago. It bites me every time. You start a test project creating a custom UIView to do some vector or path drawing and set a few ivars in the Apple-template-generated initWithFrame: method. You go on your happy way assuming the values will be set/available in all other methods completely forgetting about the stuff you added. why do you do this? Because Apple made you feel all warm/fuzzy inside with their XCode templates intended for the ObjC guy (or gal) that doesn’t recall the exact cryptic syntax of the initialization of a view. Later after a build and go button click things look all silly and junk. It’s as if nothing happened in your initialization! What’s wrong???!!! I’ll tell you what’s wrong. Better yet, I’ll yell you what’s wrong.

Because you build your view with Interface Builder INITWITHCODER: IS THE METHOD THAT IS CALLED!!! Now let’s not go into detail on how even though I knew about it this time around it still took me a moment to find the proper API to look up in the help docs to find the method definition. (I make a habit of copying the method definitions from the help docs because its a definite way to ensure you don’t mistype something and exhaust yet 80 more minutes reviewing a method that looks correctly implemented except for a missing “:” or something dumb.) A view that is loaded (or unarchived in Apple speak) from a Nib file is put togerther using one of those NSCoder dumb things. You wouldn’t know this if you were new to the technology. hell, you wouldn’t know this after a couple of years adjusting to the gnarly syntax. You would only find this out from hours of googling and StackOverflow posting for help.

I still haven’t found out how to plot a single pixel using CGPaths or some similar means in the drawRect: method. I tell you. No matter how much I learn about ObjC and CocoaTouch I’m amazed at how much escapes me on a day to day basis. I still feel like it’s my first day ever coding iPhone when I open XCode. Maybe that’s just me.

One thought on “Apple pains

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s