Coder Social home page Coder Social logo

ios-sdk-sample-gd's Introduction

Breezy for Good iOS ICC v1

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.

Objective

  1. To save your document to your GD app's Secure Container.
  2. 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.

Setup

Step 1 - Add the ServiceController files to your project

Add the following files to your project:

  • ServiceController.h
  • ServiceController.m

Step 2 - Import ServiceController.h and GDiOS.h into the desired .h file

#import <GD/GDiOS.h>
#import "ServiceController.h"

Step 3 - Add the ServiceControllerDelegate to the desired .h file

Add the delegate into your view controller

@interface YourViewController : UIViewController <ServiceControllerDelegate>

Step 4 - Allocate an instance of the ServiceController, set the delegate in the desired .m file

Initialise and set the delegate of the ServiceController

@implementation GoodClientViewController
{
    ServiceController *_serviceController;
}
// Set up a ServiceController
_serviceController = [[ServiceController alloc] init];
[_serviceController setDelegate:self];

Step 5 - Implement the following ServiceControllerDelegate methods in the desired .m file

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];
}

How to use

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];
    }
}

ios-sdk-sample-gd's People

Contributors

brlee avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.