Upgrade Guide

Skip to end of metadata
Go to start of metadata

Upgrading from Version 3.5.2 to 3.5.3

Update your Code

  1. In the Gigya class, the requestNewFacebookPublishPermissions selector has a new viewController parameter.

    /* Old selector */
    + (void)requestNewFacebookPublishPermissions:(NSString *)permissions viewControllerresponseHandler:(GSPermissionRequestResultHandler)handler
     
    /* New selector */
    + (void)requestNewFacebookPublishPermissions:(NSString *)permissions viewController:(UIViewController *_Nullable)viewControllerresponseHandler:(GSPermissionRequestResultHandler)handler

     

  2. In the Gigya class, the requestNewFacebookReadPermissions selector has a new viewController parameter.

    /* Old selector */
    + (void)requestNewFacebookReadPermissions:(NSString *)permissions viewControllerresponseHandler:(GSPermissionRequestResultHandler)handler
     
    /* New selector */
    + (void)requestNewFacebookReadPermissions:(NSString *)permissions viewController:(UIViewController *_Nullable)viewControllerresponseHandler:(GSPermissionRequestResultHandler)handler

     

Upgrading from Version 3.5.0 to 3.5.1

Update your Code

  1. In the GSRequest class, the sendSynchronouslyWithError selector was removed. Replace all occurrences with the sendWithResponseHandler selector.
  2. In the Gigya class, the session selector for accessing the GSSession instance was removed. To gain access to the GSSession instance use the getSessionWithCompletionHandler handler. This will open the Touch ID UI if necessary.
  3. To check if there is a valid session stored on the device, use the isSessionValid selector. It will never present a UI to the user.

Upgrading from Version 3.4.3 to 3.5.0

Migration to Google Sign-In

  1. Remove the Google+ Sign-In from the app.
  2. Add the Google Sign-In to the app.
  3. Add the reversed iOS client ID to the app URL scheme. See: Add URL schemes to your project.
  4. Rename the GooglePlusClientID .plist key name to GoogleClientID.

Upgrading from Version 3.2 to 3.3

Upgrade your Facebook SDK

Version 3.3 of the Gigya iOS SDK was tested with Facebook iOS SDK 4.1.0. Download the latest Facebook SDK here.

Update Method Parameters

Upgrading from Version 3.0 to 3.0.6

Upgrade Your Facebook SDK

The Gigya iOS SDK was tested with Facebook iOS SDK 3.19.

Update Facebook Permission Request

Gigya's  requestFacebookPublishPermissions  method has been renamed to  requestNewFacebookPublishPermissions , and a new parameter was added to its completion block. Make sure to update your method call.

Upgrading from Version 2.17 to 3.0

Upgrade Your External SDKs

The Gigya iOS SDK was tested with Facebook iOS SDK 3.12 and Google+ iOS SDK 1.5.
 
AppDelegate Changes:
Add the following call to your AppDelegate's applicationDidBecomeActive: method:

 

[Gigya handleDidBecomeActive];

 

 
Replace GSSessionDelegate with GSSocializeDelegate

GSSessionDelegate has been deprecated to make room for two namespace-specific listeners: GSSocializeDelegate and GSAccountsDelegate.

You may choose the one suitable to your needs.
Facebook Login
Following Facebook's policy change (https://developers.facebook.com/blog/post/2013/06/26/october-2013-platform-changes/), native iOS apps must not use their own web view for Facebook login.
This means that if your app isn't configured for Facebook Native Login, Facebook login will be disabled.
Because of this, the 'facebookExtraPermissions' param is obsolete. Facebook Native Login will request the permissions defined in your site's settings set by Gigya Platform.
If you would like to request additional permissions, add the 'facebookReadPermissions' to the login params.
 

Upgrading from Version 2.16 to 2.17

In your app's Info tab, add a URL type and enter your bundle ID as the identifier and scheme:

 

These specified Gigya methods have been deprecated and have been replaced according to the following table:

2.162.17
showLoginDialogOver:provider:loginToProvider:
showLoginDialogOver:provider: parameters:completionHandler:loginToProvider:parameters:completionHandler:
showAddConnectionDialogOver:provider:addConnectionToProvider:
showAddConnectionDialogOver:provider:parameters:completionHandler:addConnectionToProvider:parameters:completionHandler:

Upgrading from Versions Lower than 2.16

In version 2.16, Gigya’s iOS SDK has been rewritten from the ground up in order to make it easier to implement and more familiar to iOS developers. To achieve this, the structure of the classes and methods were changed, making the new 2.16 version not backwards-compatible with previous versions.

This guide takes you through the steps you need in order to upgrade an app that was developed with versions earlier than 2.16. The steps are:

Understanding the New Class Structure

In the previous versions the GSAPI class was your single point of contact. You had to create, initialize, and retain an instance of the GSAPI class, and then use it for both login and requests. From version 2.16, the GSAPI class has been replaced by the Gigya and GSRequest classes.

Gigya holds the SDK’s global settings, as well as the methods that invoke the flows for logging in, logging out, and adding or removing a connection. All of Gigya’s methods are class methods, so there is no need to create and retain your own instance.

GSRequest class is used to send a request to Gigya’s API and handle its response with completion blocks instead of a delegate.

In the previous versions, parameters for either kind of methods were passed in a GSObject instance. In the new version, the GSObject has been phased out, and parameters should be passed in a simple NSDictionary. The requests return either a GSResponse instance or a GSUser instance, depending on the API method.

The following table provides a quick summary of how to handle various tasks in the new SDK:

TaskBefore 2.16From 2.16
Initialize (in your AppDelegate’s didFinishLaunchingWithOptions: method)GSAPI *gsAPI = [[GSAPI alloc] initWithAPIKey:key];Gigya initWithAPIKey:key];
Login flow - multiple providers (show provider selection then login)GSAPI’s showLoginUI:ViewController:delegate:context:Gigya’s showLoginProvidersDialog* methods
Login flow - single provider (direct login to provider)GSAPI’s login:ViewController:delegate:context:Gigya’s showLoginDialog* methods
LogoutGSAPI’s logoutGigya’s logout* methods
Checking if the user is logged inChecking if GSAPI’s getSession returns nil[[Gigya session] isValid]
Add connection flow - multiple providers (with provider selection)GSAPI’s showAddConnectionsUI:ViewController:delegate:context:Gigya’s showAddConnectionProvidersDialog* methods
Add connection flow - single provider (direct login to provider)GSAPI’s addConnection:ViewController:delegate:context:Gigya’s showAddConnectionDialog* methods
Removing a connectionGSAPI’s removeConnection:delegate:context:Gigya’s removeConnectionToProvider* methods
Sending a requestGSAPI’s sendRequest:params:useHTTPS:delegate:context:GSRequest
Handling session changesPassing a delegate to each of the above methodsSetting Gigya’s sessionDelegate property
Handling native login (SSO) fast app switch (in your AppDelegate’s application:openURL:sourceApplication:annotation: method)GSAPI’s handleOpenURL:sourceApplication:annotation:Gigya’s handleOpenURL:sourceApplication:annotation

Updating Your Project and Dependencies

  1. Download Gigya’s iOS SDK 2.16, extract the zip file and replace the GigyaSDK.framework in your project with the new version.
  2. In your app's Info tab, add a URL type and enter your bundle ID as the identifier and scheme:

     
  3. If you're using Facebook's native login (SSO), download the Facebook iOS SDK 3.6 and replace the FacebookSDK.framework files in your project with the new version. Remove the .bundle files from the previous Facebook SDK versions.
  4. If you're using Facebook's native login (SSO) with a URL scheme suffix (using the same Facebook app ID for different iOS apps), the URL scheme suffix should be added to the plist, as opposed to passing it as a parameter to the login methods.
  5. If you're using the Google+ native login (SSO), download the Google+ iOS SDK 1.3.0 and replace the GooglePlus.framework and GoogleOpenSource.framework files in your project with the new version.
  6. Remove the -lsqlite linker flag from the build settings. Note that the -ObjC flag is still required.
  7. Version 2.15.8 required linking the project with many required frameworks. With version 2.16, you can link only frameworks that you really use, for example, there is no need to add Twitter.framework if you aren’t using Twitter SSO.
    In your project’s settings, add or remove frameworks from “Linked Frameworks and Libraries” according to this table:

    Before 2.16From 2.16+ Facebook Native Login+ Google+Native Login+ Twitter SSO
    GigyaSDK.framework
    FacebookSDK.framework
    GooglePlus.framework
    GoogleOpenSource.framework
    Twitter.framework
    Social.framework
    AdSupport.framework
    Accounts.framework
    SystemConfiguration.framework
    Security.framework
    libsqlite3.dylib 
    GigyaSDK.frameworkFacebookSDK.frameworkGooglePlus.framework
    GoogleOpenSource.framework
    SystemConfiguration.framework
    Security.framework
    Twitter.framework
    Accounts.framework
  8. In your source files, remove all #includes for GigyaSDK classes and replace with a single line:

    #include <GigyaSDK/Gigya.h>
  9. In your AppDelegate file, replace:

    gsAPI = [[GSAPI alloc] initWithAPIKey:@"PUT-YOUR-APIKEY-HERE"];

    with:

    [Gigya initWithAPIKey:@”API-KEY”];
  10. If you're using the Facebook or Google+ native login, in your AppDelegate file, replace:

    - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
    {
      if(viewController.gsAPI != nil)
        return [viewController.gsAPI handleOpenURL:url sourceApplication:sourceApplication annotation:annotation];
      return NO;
    }

    with:

    - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
    {
        return [Gigya handleOpenURL:url sourceApplication:sourceApplication annotation:annotation];
    }

Updating the Login Process

In previous versions, when calling GSAPI’s login: or showLoginUI: methods, you passed a delegate parameter that handled the login process result. In 2.16, this can be achieved in one of two ways:

  1. Calling one of Gigya’s showLoginDialog* or showLoginProvidersDialog* with a completion handler. The completion handler should handle the login flow’s success or failure.
  2. Setting a global session delegate using Gigya’s setSessionDelegate, which will handle any change in the active session (login, logout, other session changes).

The example below demonstrates how to migrate from the old showLoginUI method to the new showLoginProviders method. The same migration can be applied to the other login and add connection methods, as mapped in the table above.

Migration Example

Old way: 

- (void)doGigyaLogin

{
    // Create the params object
    GSObject *params = [[GSObject alloc] init];

    [params setValue:@"facebook,googleplus,twitter" forKey:@"enabledProviders"];
    [params setValue:@"captionText" forKey:@"Social Login"];

    [self.m_pGSAPI showLoginUI:params
                ViewController:self
                      delegate:self
                       context:nil];
}

- (void)gsLoginUIDidClose:(id)context canceled:(BOOL)bCanceled
{
    // Gigya's UI was closed
}

- (void)gsLoginUIDidFail:(GSResponse*)response context:(id)context
{
    // Handle login failure, according to response.errorCode
}

- (void)gsLoginUIDidLogin:(NSString*)provider user:(GSObject*)user context:(id)context
{
    // Handle login success
}

 

New way: 

- (void)doGigyaLogin
{
    // Parameters are passed using NSDictionary instead of GSObject
    NSDictionary *params = @{ @"captionText": @"Social Login" };

    [Gigya showLoginProvidersDialogOver:self
                             providers:@[ @"facebook", @"googleplus", @"twitter" ]
                             parameters:params

                      completionHandler:^(GSUser *user, NSError *error) {
                          // Gigya's UI was closed
                          if (!error) {
                              // Handle login success
                          }
                          else if (error.code == GSErrorAccountPendingRegistration){
                              // Handle user account pending registration. User info already exists in user object.
                          }
                          else {
                              // Handle login failure, according to error.errorCode
                          }
                      }];
}

Updating the Requests Process

In previous versions sending a request to the Gigya REST API was done by using GSAPI’s sendRequest method, passing a delegate to handle the response. In 2.16, this functionality was separated to a new class called GSRequest. For every request, you must create a GSRequest instance, set its parameters (if needed), and send it, passing a completion block for the response handling code.

Migration Example

Old way: 

- (void)setUserStatus
{
    // Step 1 - Defining request parameters
    GSObject *params = [[GSObject alloc] init];
    [params putStringValue:@"I feel great" forKey:@"status"];

    // Step 2 - Sending the request
    [gsAPI sendRequest:@"socialize.setStatus" params:params
              delegate:self
               context:nil]
}

- (void)gsDidReceiveResponse:(NSString *)method response:(GSResponse *)response context:(id)context
{
    if (response.errorCode == 0) {
        // Handle success
    }
    else {
        // Handle failure
    }
}

 

New way: 

// Step 1 - Create the request and set the parameters
GSRequest *request = [GSRequest requestForMethod:@"socialize.setStatus"];
[request.parameters setObject:@"I feel great" forKey:@"status"];

// Step 2 - Send the request and handle the response
[request sendWithResponseHandler:^(GSResponse *response, NSError *error) {
    if (!error) {
        // Handle success
    else {
        // Handle failure
    }
}];
 

Facebook and Google+ SDK Supported Versions

Gigya's iOS SDK has been tested with the latest Facebook and Google+ SDKs, currently at 3.17 and 1.7 respectively.