File selector integration using Objective-C | Sequencing.com

Real-Time Personalization (+RTP) API Guide

Here we will show how to quickly integrate Sequencing File selector harnesses into your Objective-C based application.

Unless you have specific reason, please refer to "Master plugins" or "Sample applications" section as they provide kit for quick boot-straping mobile applications in all in one package.

 

We have developed a CocoaPod component to simplify using Objective-C library in your project. If you are new to CocoaPods, refer to the official guide.

There are several prerequisites in order to complete the integration:

  • you need to have a Sequencing account
  • you need to have an OAuth2 application secret
  • you have valid OAuth2 authentication token 

In order to complete integration follow instructions below.

By following steps below you would get following UI

   

   

 

Prepare environment

1) Open existing XCode project or create new one
2) Create Podfile in your project directory:
$ pod init
3) specify following pod parameters in Podfile
pod 'sequencing-file-selector-api-objc', '~> 1.3.2'
4) Install the dependency in your project using terminal
$ pod install
5) Use Xcode workspace instead of the project file
$ open *.xcworkspace
 

Set up OAuth2 module

Refer to the appropriate guide.
 

Prepare file selector

 

1) Add file selector protocol import in your class were you getting and handling file selector

#import "SQFileSelectorProtocol.h"
#import "SQFilesAPI.h"

2) Subscribe your UIViewController to file selector protocol SQFileSelectorProtocol

3) Implement methods from SQFileSelectorProtocol protocol

- (void)selectedGeneticFile:(NSDictionary *)file {
}
 
- (void)errorWhileReceivingGeneticFiles:(NSError *)error {
}

- (void)closeButtonPressed {
}

4) call file selector via method showFilesWithTokenProvider: showCloseButton: previouslySelectedFileID: delegate:

- (void)showFilesWithTokenProvider:(id<SQTokenAccessProtocol>)tokenProvider
                 showCloseButton:(BOOL)showCloseButton
                 previouslySelectedFileID:(NSString *)selectedFileID
                 delegate:(UIViewController<SQFileSelectorProtocol> *)delegate;

where

  • tokenProvider - SQOAuth instance (could be acquired as [SQOAuth sharedInstance])
  • showCloseButton - provide BOOL value to specify if you want to have Close button in file selector dialog
  • selectedFileID - provide file ID if you want to specific file be pre-selected and focused
  • delegate - UIViewController class instance that conforms to "SQFileSelectorProtocol" protocol

 

When user selects any file and clicks on "Continue" button in UI - selectedGeneticFile: method from SQFileSelectorProtocol will be called then. Selected file will be passed there as a parameter. In this method you may handle selected file.

Each file is a NSDictionary object with keys and values format as specified here