GithubHelp home page GithubHelp logo

paragkavar / gsdropboxactivity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rajdn/gsdropboxactivity

0.0 2.0 0.0 1.98 MB

An iOS 6 UIActivity subclass implementing uploads to Dropbox – as used in Zippity.app

Home Page: http://goosoftware.github.com/

License: Other

gsdropboxactivity's Introduction

GSDropboxActivity

GSDropboxActivity is an iOS 6 UIActivity subclass for uploading to Dropbox.

Usage instructions

1. Install the Dropbox iOS SDK

Download the latest Dropbox iOS SDK and follow Dropbox's instructions for incorporating it into your app.

GSDropboxArchive assumes you have configured the shared DBSession object appropriately. If you follow Dropbox's integration instructions you will have done this. In essence, you just need to make sure you include this in your application delegate's application:didFinishLaunchingWithOptions: method:

#import <DropboxSDK/DropboxSDK.h>

...

DBSession* dbSession = [[DBSession alloc] initWithAppKey:@"APP_KEY"
                                               appSecret:@"APP_SECRET"
                                                    root:ACCESS_TYPE]; // either kDBRootAppFolder or kDBRootDropbox
[DBSession setSharedSession:dbSession];

2. Add GSDropboxActivity to your project

Just copy the GSDropboxActivity folder into your project.

3. Add a GSDropboxActivity object to your list of custom activities and share some NSURL objects

GSDropboxActivity can share NSURL objects where each object is the URL of a file on the local disk.

- (void)handleShareButton:(id)sender
{
    NSArray *itemsToShare = @[
        // Your items to share go here.
        // GSDropboxActivity can share NSURL objects where each object is
        // the file URL to a file on disk.
    ];
    NSArray *applicationActivities = @[
        [[GSDropboxActivity alloc] init]
    ];
    UIActivityViewController *vc = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare
                                                                     applicationActivities:applicationActivities];

    // Present modally - suitable for iPhone.
    // On iPad, you should present in a UIPopoverController
    [self presentViewController:vc animated:YES completion:NULL];
}

4. Listen out for notifications

The following notifications are declared in GSDropboxUploader.h:

GSDropboxUploaderDidStartUploadingFileNotification

Fired when a file starts uploading.

userInfo dictionary entries:

  • GSDropboxUploaderFileURLKey: the URL of the file being uploaded

GSDropboxUploaderDidFinishUploadingFileNotification

Fired when a file finishes uploading.

userInfo dictionary entries:

  • GSDropboxUploaderFileURLKey: the URL of the file being uploaded

GSDropboxUploaderDidGetProgressUpdateNotification

Fired periodically while a file is uploading.

userInfo dictionary entries:

  • GSDropboxUploaderFileURLKey: the URL of the file being uploaded
  • GSDropboxUploaderProgressKey: the current upload progress; an NSNumber whose floatValue is between 0.0 and 1.0

GSDropboxUploaderDidFailNotification

Fired when a file fails to upload.

userInfo dictionary entries:

  • GSDropboxUploaderFileURLKey: the URL of the file being uploaded

License

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License.

You're free to use this code in any project, including commercial. Please include the following text somewhere suitable, e.g. your app's About screen:

Uses GSDropboxArchive by Simon Whitaker

gsdropboxactivity's People

Watchers

 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.