Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-17888

iOS: Add support for Swift libraries in native modules


    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: iOS
    • Labels:
    • Story Points:
    • Sprint:
      2018 Sprint 07 SDK


      Modules that have frameworks built using Swift do not work. Modules compile, but when you try to build an app using the module, you get errors:

      ld: embedded dylibs/frameworks are only supported on iOS 8.0 and later (@rpath/ChasePaymentech.framework/ChasePaymentech) for architecture i386

      As you can see from the error, we attempted to implement the Chase Paymentech SDK. Chase puts the Paymentech SDK download behind a login wall... We can't provide it, but you can sign up (free) and download it.

      So, to reproduce this error (and possibly fix it), my steps:

      Create the module

      1. ti create -n ti.test -p ios --id ti.test -t module -url "http://test.com" -d .
      2. Open up the project in Xocde. Confirm it builds.
      3. Download the library from https://secure.paymentech.com/developercenter/mobilesdk/ios/?WT.mc_id=adc001_sdk
      4. Place the .framework file in <module_root>/iphone/platform
      5. Drag the file into the source explorer in Xcode. No need to copy it (as it's already in the project). Or you can follow the linking instructions in the paymenttech docs
      6. Edit the module.xcconfig file to reference the framework:

      // How to add a Framework (example)
      OTHER_LDFLAGS=$(inherited) -framework ChasePaymentech

      The module builds without error for me (both from inside Xcode and from the command line).

      Create the application

      1. Drop the built module into the global module cache (Unzipped). For me this is ~/Library/ApplicationSupport/Titanium/modules/iphone
      2. Open Studio
      3. Create a new 2-tabbed app, iPhone/iPad only
      4. Add the module to the application from the tiapp.xml editor
      5. Drop to the command line. 'ti build -p iOS'.

      The app will fail to build, unable to find the ChasePaymentech framework

      Fix the Xcode project

      1. Open builds/iphone/<AppName>.xcodeproj
      2. Follow the instructions in the Paymenttech document to both link the framework in the application, and then to copy the framework during the build process.
        1. Place the framework library in a folder accessible to your application.
        2. Select Project Setting and Build Phase. Click on “Link Binary With Libraries” section. Then press “+” button to add the framework.
        3. Click on “Add Other…” and choose ChasePaymentech.framework from the physical location in step 1.
        4. Click “Copy Files”, ensure “Framework” is selected in “Description” drop-down. Click “+” as indicated below.
        5. Select “ChasePaymentech.framework” under “frameworks”.
        6. Under “Project Navigator”, within “Frameworks”, “ChasePaymentech.framework” would have been added.

      Attempt to build the application, you will get the error about "ld: embedded dylibs/frameworks are only supported on iOS 8.0 and later"

      To Fix it

      Build Settings > iOS Deployment Target. Update this to 8.0

      App builds successfully...sometimes. When it fails, it appears to fail because it can't find the Chase framework. This suggests that the framework isn't being copied in time to the correct output location before linking.


          Issue Links



              • Assignee:
                hknoechel Hans Knöchel
                iotashan Shannon Hicks
              • Watchers:
                1 Start watching this issue


                • Created:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    Sync status:
                    Last received:
                    Last sent:

                    Git Integration