Skip to content

1.9.0.1 and Later

Changes

  • Moved features

Some features were moved out in separate libraries. That allows to skip not used features and its dependencies. For now Google Analytics, Google SignIn and Google Cloud Messaging are optional and has to be explicitly installed and configured.

  • Static linked

The dynamic linked framework TapkeyMobileLib.framework was replaced with split static linked frameworks. Which allows better optimization and smaller bundle sizes for the consuming app.

  • Universal Binary

Framework binaries includes now i386 and x86_64 architectures, which allows to run the consuming app in simulator during development.

  • Bitcode

Bitcode is now included, which allows the consuming app to have bitcode enabled too.

  • Cocoapod

Podspecs were added, which allows an easy integration via cocoapod.

Migration

Project Settings

The framework itself will be integrated via cocoapod. Remove following manual added settings from consuming project.

  • Remove TapkeyMobileLib.framework from linked and embedded dependencies
  • Remove [YOUR_APP_SDK_PATH]/iOS/Libs from framework search path
  • Remove [YOUR_APP_SDK_PATH]/iOS/Libs/Headers from header search path
  • Remove source files from project, which was included from *[YOUR_APP_SDK_PATH]/iOS/Libs/TapkeyMobileLibSource

Extract compressed archive

The used frameworks are now in an bzip2 compressed archive and has to be extracted first. So extract the file Libs.tar.bz2 to Libs with your preferred extracting tool.

For example via command line:

tar -xf Libs.tar.bz2

Podfile

Integration via cocoapod was simplified. Change following lines in your Podfile

...

# Remove line
# load '[YOUR_APP_SDK_PATH]/iOS/Libs/PodDependencies'

target 'App' do

    [your dependencies]

    # Remove line
    # tk_mobile_lib_pods

    # Add line
    pod 'TapkeyMobileLib', :path => '[YOUR_APP_SDK_PATH]iOS/Libs'

    # Add line if Google Cloud Messaging
    # is in use
    pod 'TapkeyGCM', :path => '[YOUR_APP_SDK_PATH]/iOS/Libs'

end

...

Change TapkeyService Factory in AppDelegate

The TapkeyServiceFactory does not use Push Notifications by default anymore, so there is an API change on TapkeyServiceFactoryBuilder. The gcmAdapter parameter was removed from TapkeyServiceFactoryBuilder:build()

Change the TapkeyServiceFactory bootstrap from

         // Create a Google Cloud Messaging Adapter to allow Tapkey to register and
         // receive push notification
         //
         // To receive push notification in development builds, the sandbox flag must be set to true.
         //
         let gcmAdapter = TkGcmAdapterImpl(sandbox: false);

         // Build service factory singleton instance
         let tapkeyServiceFactory:TapkeyServiceFactory = TapkeyServiceFactoryBuilder()
             .build(application: application, gcmAdapter: gcmAdapter);
to

        // Build service factory singleton instance
        let tapkeyServiceFactory:TapkeyServiceFactory = TapkeyServiceFactoryBuilder()
            .build(application: application);

Remove Push Notification (OPTIONAL)

If the consuming App should use Push notifications, skip this step!

If the consuming app should not use push notification, following code snippets can be removed from AppDelegate:

...

     // Forward APN registration callbacks to Tapkey. This is required for push notifications function properly.
     func application( _ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken
         deviceToken: Data ) {

        guard let cloudMessageManager = self.tapkeyServiceFactory?.getCloudMessagingManager() else {
            return;
         }

        cloudMessageManager.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken);
     }
...
...
     // Forward APN registration callbacks to Tapkey. This is required for push notifications function properly.
     func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {

        guard let cloudMessageManager = self.tapkeyServiceFactory?.getCloudMessagingManager() else {
            return;
         }


        cloudMessageManager.didFailToRegisterForRemoteNotificationsWithError(error);
     }
...
...
     // Forward APN push notifications to Tapkey. This is required for push notifications function properly.
     func application( _ application: UIApplication,
                       didReceiveRemoteNotification userInfo: [AnyHashable: Any],
                       fetchCompletionHandler handler: @escaping (UIBackgroundFetchResult) -> Void) {


        if let cloudMessageManager = self.tapkeyServiceFactory?.getCloudMessagingManager() {

            cloudMessageManager.didReceiveRemoteNotification(userInfo as [AnyHashable: Any], fetchCompletionHandler: handler, cancellationToken: TkCancellationToken_None);


         }else{
             handler(UIBackgroundFetchResult.failed);
         }

     }

...

Upgrade Push Notification (OPTIONAL)

If the consuming app should not use push notification skip this step!

The Push Notification was moved to an own framework and are optional now.

Make sure that the Pod dependency TapkeyGCM is deposited:

...

target 'App' do
    [your dependencies]
    pod 'TapkeyMobileLib', :path => '[YOUR_APP_SDK_PATH]/iOS/Libs'
    pod 'TapkeyGCM', :path => '[YOUR_APP_SDK_PATH]/iOS/Libs'
end

...

Add following imports to AppDelegate:

...
import TapkeyGCM
...

Create and register TkCloudMessagingManagerImpl during TapkeyFactory bootstrap

...

    // Add reference for CloudMessagingManager instance
    fileprivate var cloudMessagingManager: TkCloudMessagingManagerImpl?;

    func application(_ application: UIApplication,
                     willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
        ...


        // Replace
        let gcmAdapter = TkGcmAdapterImpl(sandbox: false);
        // with
        self.cloudMessagingManager = TkCloudMessagingManagerImpl(application: application, tapkeyAppDelegate: self, sandbox: false);

        self.cloudMessagingManager = TkCloudMessagingManagerImpl(application: application, tapkeyAppDelegate: self, sandbox: false);

        let tapkeyServiceFactory:TapkeyServiceFactory = TapkeyServiceFactoryBuilder()

            // Register created CloudMessagingManager to TapkeyServiceFactoryBuilder
            .setCloudMessagingManager(self.cloudMessagingManager!)

            .build(application: application);

        ...
    }

...

Update APN callbacks in AppDelegate:

...

    func application( _ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken
         deviceToken: Data ) {


        ////
        // Replace
        guard let cloudMessageManager = self.tapkeyServiceFactory?.getCloudMessagingManager() else {
            return;
         }

        cloudMessageManager.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken);
        // with
        if let cloudMessagingManager = self.cloudMessagingManager {
            cloudMessagingManager.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken);
         }
        ////

     }

     ...

     func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {

        ////
        // Replace
        guard let cloudMessageManager = self.tapkeyServiceFactory?.getCloudMessagingManager() else {
            return;
         }

        cloudMessageManager.didFailToRegisterForRemoteNotificationsWithError(error);
        // with
        if let cloudMessagingManager = self.cloudMessagingManager {
            cloudMessagingManager.didFailToRegisterForRemoteNotificationsWithError(error);
         }
        ////
     }

     ...

     // Forward APN push notifications to Tapkey. This is required for push notifications function properly.
     func application( _ application: UIApplication,
                       didReceiveRemoteNotification userInfo: [AnyHashable: Any],
                       fetchCompletionHandler handler: @escaping (UIBackgroundFetchResult) -> Void) {

        ////
        // Replace
        if let cloudMessageManager = self.tapkeyServiceFactory?.getCloudMessagingManager() {

            cloudMessageManager.didReceiveRemoteNotification(userInfo as [AnyHashable: Any], fetchCompletionHandler: handler, cancellationToken: TkCancellationToken_None);

         }else{
             handler(UIBackgroundFetchResult.failed);
         }
        // with
        if let cloudMessagingManager = self.cloudMessagingManager {

            cloudMessagingManager.didReceiveRemoteNotification(userInfo as [AnyHashable: Any], fetchCompletionHandler: handler, cancellationToken: TkCancellationToken_None);

         }else{
             handler(UIBackgroundFetchResult.failed);
         }
         ////
     }

...