Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An iOS 6 UIActivity subclass implementing uploads to Dropbox – as used in Zippity.app
Objective-C C
branch: master

Merge pull request #6 from cocologics/fix/edgeCases

Fix never ending login loop & choose Button
latest commit 2c31b4ab46
Simon Whitaker simonwhitaker authored
Failed to load latest commit information.
GSDropboxActivity disable choose button while there's no valid data yet
GSDropboxDemoApp Add new icon for iOS 7 (retains original icon for iOS <= 6)
artwork
.gitignore Initial commit
LICENSE Initial commit
README.md Updated image URL

README.md

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 GSDropboxActivity by Simon Whitaker

Something went wrong with that request. Please try again.