Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.

1.2 OS X Integration

Ruben Nine edited this page Aug 14, 2015 · 2 revisions
  1. Get an API Key
  • Go to Filepicker.io to register an account.
  • API Keys are typically randomized and 20 characters long.
  1. Add FPPicker to your Podfile
platform :osx, '10.9'

use_frameworks!

target :'MyImagesApp' do
  pod 'FPPicker', '~> 5.0.0'
end
  1. Run pod install

  2. Setup

  • Add @import FPPickerMac; to your app delegate (i.e., typically AppDelegate.m)

  • Add the following code on your app delegate and use the API Key you got after registering:

    + (void)initialize
    {
        [FPConfig sharedInstance].APIKey = @"SET_FILEPICKER.IO_APIKEY_HERE";
    }
  1. In Use

  2. @import FPPickerMac; into your ViewController.h or anywhere else you may want to use Filepicker.

  3. Make your controller conform to the FPPickerControllerDelegate (and optionally to the FPSaveControllerDelegate): objc @interface ViewController () <FPPickerControllerDelegate, FPSaveControllerDelegate> @end

  4. Instantiate the objects and configure them ```objc FPPickerController *pickerController = [FPPickerController new]; pickerController.delegate = self; (...)

FPSaveController *saveController = [FPSaveController new];
saveController.delegate = self;
(...)

```
  1. Implement the delegate methods ```objc #pragma mark - FPPickerController Delegate Methods
- (void)FPPickerController:(FPPickerController *)pickerController didFinishPickingMediaWithInfo:(FPMediaInfo *)info
{
  // Handle accordingly
}

- (void)FPPickerControllerDidCancel:(FPPickerController *)pickerController
{
  // Handle accordingly
}

#pragma mark - FPSaveController Delegate Methods

- (void)FPSaveController:(FPSaveController *)saveController didFinishSavingMediaWithInfo:(FPMediaInfo *)info
{
  // Handle accordingly
}

- (void)FPSaveControllerDidCancel:(FPSaveController *)saveController
{
  // Handle accordingly
}

(...)
```
Clone this wiki locally