We don’t have any code that can be invoked, but I couldn’t find what exc_bad_access was, so it’s probably bad.
I have not found any exc_bad_access code either. I don’t think its a bug though. I think its an undocumented feature, and if you’re running iOS 7 or later, you should be okay.
I had hoped I would find a bug, but I didn’t expect to. I have no idea what exc_bad_access is, but apparently it is what causes iOS 7 to crash as soon as you try to create a new app delegate instance. That’s bad. I’m not sure if I’ve ever seen this crash before, but if you are, and you’re running iOS 7 or later, you should definitely file a bug about it.
The official appdelegate thread is a little confusing, but if you make the app delegate your application delegate, it will be your delegate instead of the main application delegate. That way you dont have to worry about accessing the AppDelegate from your main application delegate.
Using a delegate when creating an app delegate is really the wrong approach. Because a delegate is a special class that represents a delegate-class, it is no longer a class-class. In a delegate, you can do everything you need to communicate with the delegate, including accessing the delegate’s state. The state of the delegate isn’t actually a class. The state of the delegate class is a special class, so there is no way for you to access the delegate’s state.
I have to be honest here and say that I have not read this article. But it is a really good article on this topic that is worth the read. If you haven’t read it, I encourage you to do so.
If you have read this article, this is not an article about self-awareness. This is an article about delegation and memory management. It’s very important when dealing with delegate types to understand how you can access the delegates memory.
You should think about it and figure out what you have to do. I have read this in the past and I would say that the time has come for the developers to be more open to the idea of this type of solution.
For the time being, the only solution we have is to make our own version of delegation. For now, the developers of appdelegate (and all other delegates) are required to accept the delegate type of self.
There is a new type of delegate in iOS 6 called DelegatedObject. It can be used to “delegate” a delegate object. This is a little like a subclass of NSObject. Like other NSObject subclasses, it inherits all of it’s methods but the delegate property is set to a new property. So a delegate object can call methods on its delegate object.