how to extend a protocol for a delegate in objective C, then subclass an object to require a conforming delegate

The UITextView defines its delegate as @property(nonatomic, assign) id<UITextViewDelegate> delegate meaning it conforms to UITextViewDelegate, and that’s what compiler checks. If you want to use the new protocol, you need to redefine delegate to conform to your protocol: @interface MySubClass : UITextView { } @property(nonatomic, assign) id<MySubClassDelegate> delegate @end The compiler shouldn’t give any more … Read more

Can’t add self as subview

tl;dr – see the Conclusion at the bottom. I too have been getting occasional crash reports through from users regarding this, and then today suffered the indignity of it for myself. This was caused when selecting a row on my table view attempted to push a new nav controller, and then I pressed the back … Read more

How can I avoid “duplicate symbol” errors in xcode with shared static libraries?

Carl’s answer is right, but for the wrong reasons: there’s actually nothing wrong with linking static libraries together, as we can see using Carl’s own sample. Set-up Carl’s sample code and then do this: (I use libtool because that is what XCode uses) neutron:libtest jamie$ libtool -o a2.a a.a c.a neutron:libtest jamie$ libtool -o b2.a … Read more

Toll free bridges

Toll-free bridging means that the data structures are interchangeable. It is just as simple as casting — that’s the “toll-free” part. Anyplace you can use the type on one side of the bridge, you can use the other. So, for example, you can create a CFString and then send NSString messages to it, or you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)