This repository has been archived by the owner on Apr 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
1.2 OS X Integration
Ruben Nine edited this page Aug 14, 2015
·
2 revisions
- Get an API Key
- Go to Filepicker.io to register an account.
- API Keys are typically randomized and 20 characters long.
- Add
FPPicker
to yourPodfile
platform :osx, '10.9'
use_frameworks!
target :'MyImagesApp' do
pod 'FPPicker', '~> 5.0.0'
end
-
Run
pod install
-
Setup
-
Add
@import FPPickerMac;
to your app delegate (i.e., typicallyAppDelegate.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"; }
-
In Use
-
@import FPPickerMac;
into yourViewController.h
or anywhere else you may want to use Filepicker. -
Make your controller conform to the FPPickerControllerDelegate (and optionally to the FPSaveControllerDelegate):
objc @interface ViewController () <FPPickerControllerDelegate, FPSaveControllerDelegate> @end
-
Instantiate the objects and configure them ```objc FPPickerController *pickerController = [FPPickerController new]; pickerController.delegate = self; (...)
FPSaveController *saveController = [FPSaveController new];
saveController.delegate = self;
(...)
```
- 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
}
(...)
```