objective-c Archives - Byron Salau

objective-c singleton macro that supports both ARC enabled and disabled projects

Posted by | objective-c | 3 Comments

Im a big fan of Matt Gallagher’s singleton macro and have been using a slightly modified version of it by Oliver Jones.

Lately however I’ve been enabling ARC in my projects and came across the problem of including the macro only to have xcode whinge to me about all the release methods. I’m using a library so I wanted my macro to support both environments. I initially went back to Matt’s macro to see if he perhaps updated for this situation but it seems not so. I was also surprised to see that i couldn’t really find any thing else useful on the subject.

Read More

How to create a Tweet Sheet the correct way in iOS 5

Posted by | objective-c | One Comment

With the many new features introduced in iOS 5 I was particularly excited about the new Twitter.framework. Apple customers can now enjoy the pleasures of having their Twitter accounts baked right into the OS granting access to the twitter-verse from every nook and cranny in the device. While developers can now integrate twitter into their apps much faster and more easily than it has ever been before.

Read More

How to fix “this class is not key value coding-compliant for the key”

Posted by | objective-c | No Comments

If you ever come across this error:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key ...'

It is likely you have either renamed an IBOutlet property or removed a nib (.xib) file associated with your class.

If you removed the nib and decided to go nibless you can fix this error by simply selecting “Reset Content and Settings” from the ios simulator menu or “delete” the app from your device. You may also have to perform a “Clean” in xcode (Product > Clean).

Otherwise, If you still have your nib and renamed an IBOutlet property then simply open the nib file and reconnect your IBOutlet with its corresponding UI control. You may also need to disconnect the old one. It should appear grayed out.

Repair -weak_library /usr/lib/libSystem.B.dylib for Urban Airship

Posted by | objective-c | No Comments

This week I was implementing Urban Airship into my application when i came across this weird behaviour. I followed the documentation and implemented all the steps only to find the application would crash with “EXEC_BAD_ACCESS” before if even finished loading. A little confused I tried to NSZombie the root of the cause however instruments wouldn’t attach to the target and I had to force quite instruments just to regain control of my computer.

Going back on my steps I narrowed the issue down to setting the following flag in the targets “Other Linker Flags”

-weak_library /usr/lib/libSystem.B.dylib

You will most likely have that reference because your are either using Urban Airship or Flurry analytics in your projects.

Apparently this library is not available on the ios simulator above SDK version 4.2. So, If you are experiencing problems with this I suggest you try using the following flag instead