AppConnectUIApplication class

Using your own UIApplication subclass

If your app uses its own subclass of UIApplication, derive your subclass from AppConnectUIApplication instead of UIApplication. Information on subclassing AppConnectUIApplication, provided in AppConnectUIApplication.h, is in Using your own UIApplication subclass.

originalDelegate property (deprecated)

Most apps have no reason to use this property.

The AppConnectUIApplication class also provides one property:


@property(nonatomic, readonly) id<UIApplicationDelegate> originalDelegate;

The AppConnect library depends on knowing about application life cycle events, such as when the application becomes active. Requiring the app to pass every life cycle event to the AppConnect library would be too much of a burden on the app. Therefore, the AppConnect library installs a UIApplicationDelegate proxy. This proxy sits between the UIApplication and your application’s UIApplicationDelegate.

Your application does not do anything to support the proxy. Use your UIApplicationDelegate as you normally would:

The AppConnect library does not filter or modify any messages sent by iOS to the UIApplicationDelegate.

You can still add custom methods to your UIApplicationDelegate. Call the custom method as you normally would, such as in the following statement:

[[UIApplication sharedApplication] delegate] customMethod];

The proxy passes the method invocation to your UIApplicationDelegate.

You can set a new UIApplicationDelegate as you normally would:

[[UIApplication sharedApplication] setDelegate:myOtherAppDelegate];

However, until AppConnect 4.0 for iOS, a side effect of the proxy was that the following expression did not return your UIApplicationDelegate object:

[[UIApplication sharedApplication] delegate]

Therefore, the originalDelegate property was available to return your UIApplicationDelegate object. Using this property is no longer necessary because the above expression now does return your UIApplicationDelegate object.

Note the following:

Another side effect of the proxy was that the following expression did not return your UIApplicationDelegate’s class:

[[[UIApplication sharedApplication] delegate] class]

Instead, it returned the proxy class. Therefore, using isKindofClass: was necessary. For example, the following returned YES:

[[UIApplication sharedApplication] isKindOfClass:[MyAppDelegate class]]