Errors and state changes that occur when using GDPushConnection are handled by creating a class that implements this protocol.
The following code snippets illustrate some common tasks.
@interface BasicHandler : NSObject <GDPushConnectionDelegate> {} @end @implementation BasicHandler -(void)onStatus:(int)status { if ( [[GDPushConnection sharedConnection] isConnected] ) { NSLog( @"Connected OK. Push Channel service available."); } else { NSLog( @"Push Channel service not available."); } } @end
The above snippet shows a very simple handler for GDPushConnection state-change. The availability of the Push Channel service is written to the system log.
basicDelegate = [[BasicHandler alloc] init]; connection.delegate = basicDelegate;
The above snippet shows how the above handler could be associated with the Push Connection.