How do I access the shared delegate or the device specific “delegate” in a Universal App?
I want to store properties on the Shared delegate and put basic logic there, but if I want to do, say iPhone specific stuff on the iPhone delegate, I would assume that I need to access the two delegates separately. Is this correct?
How do I access these delegates in code?
I’m not sure what you mean by device-specific delegates. I’m assuming that by “shared delegate” you’re referring to your application delegate. If you needed something specific to iPhone or iPad, you could do this:
That’s better than using
#defines because you can compile one universal app to work across all iOS devices.EDIT: Added some introspection to prevent this from crashing on iPhone OS 3.1.x and earlier. Thanks, Bastian.