This is a demo app to use with Breezy for Good. This app demonstrates how to use ICC to transfer a file from a GD App to Breezy for Good for printing.
- To save your document to your GD app's Secure Container.
- Transfer the document from your GD app's Secure Container to Breezy for Good's Secure Container.
Breezy for Good supports the following filetypes:
Imported File, PDF, Postscript, Encapsulated PostScript, GIF, Bitmap, Microsoft Word, Microsoft Excel, Microsoft Powerpoint, Apple Keynote, eFax Fax, PNG, TIFF, JPEG, Generic Image, XML, TXT, Generic Text, Generic Mixed Content, Generic.
Add the following files to your project:
- ServiceController.h
- ServiceController.m
#import <GD/GDiOS.h>
#import "ServiceController.h"
Add the delegate into your view controller
@interface YourViewController : UIViewController <ServiceControllerDelegate>
Initialise and set the delegate of the ServiceController
@implementation GoodClientViewController
{
ServiceController *_serviceController;
}
// Set up a ServiceController
_serviceController = [[ServiceController alloc] init];
[_serviceController setDelegate:self];
Add the following methods into your view controller:
- (void) showAlert:(id)serviceReply
{
if ([serviceReply isKindOfClass:[NSString class]])
{
// The Transfer Service returned a defined success response...
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:serviceReply
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
else if ([serviceReply isKindOfClass:[NSError class]])
{
NSError* error = (NSError*)serviceReply;
// The Transfer Service returned a defined error response...
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:[error domain]
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
else
{
// The Transfer Service returned an unexpected response...
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Not implemented."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
}
- (void) showErrorAlert:(NSError*)goodError
{
// Show alert with appropriate error message
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"An error occurred."
message:[goodError localizedDescription]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
Pass the name of the file you want to print to your instance of the ServiceController using the method - printFile:file withError:error Make sure the file is in your GD Secure Container.
- (IBAction)printPressed:(id)sender
{
NSError *err = nil;
NSString *fileToPrint = [self fileInGDContainer];
// Pass the name of the file in your GD Container using the printFile method
BOOL didSendRequest = [_serviceController printFile:fileToPrint withError:&err];
if (NO == didSendRequest)
{
// The request could not be sent...
[self showErrorAlert:err];
}
}