Skip to Content
Product Information

Introducing Mac Catalyst support for SAP Cloud Platform SDK for iOS

Overview

SAP Cloud Platform SDK for iOS 5.0 introduces support for Mac Catalyst. You can use Mac Catalyst to create a Mac version of your iPhone or iPad app.

Starting from 5.0, the SDK components are now distributed in the .xcframework bundle format, which packs dependencies under all target platforms and architectures into a single bundle.

To learn more about XCFrameworks & Mac Catalyst supportgo to https://developer.apple.com/mac-catalyst/ 

Creating a new app for Mac Catalyst using the Assistant

1. Generate a project with Mac Catalyst support

 

The SAP Cloud Platform SDK for iOS Assistant adds Mac Catalyst support during project creation. To enable support for Mac Catalyst in the newly generated application, check this box as shown below

 

The Assistant has performed the following steps during project generation: 

  • All the SDK frameworks used by the app are in the .xcframework format 
  • The app target has been enabled to run additionally on Mac   

 

 

  • A build script which signs the embedded SDK frameworks with your Signing Certificate has been added to the Build Phases. The build script is located at ./scripts/codesign.py. As of Xcode 11.3.1, it is not sufficient to select ‘Embed & Sign’ in the link section, therefore this additional step is required. 

 

Before you can run the app on Mac, you need to perform the following pre-requisites: 

Pre-requisites 

For apps with Automatic Signing 

a) Add the Keychain Sharing capability:

This is to enable the read/write to the Mac system keychain. No actual *sharing* is required or expected–we just want the rights to access the keychain as we do on iOS devices.

Just adding the Keychain sharing capability doesn’t work in Xcode 11.3.1, adding an app group works better. 

  • Add an App Group Capability from Signing & Capabilities Section using +Capability tab 
  • Create an App Group identifier under Signing & Capabilities -> App Groups 
  • Verify that Provisioning Profile is set to Xcode Managed Profile 

b) Specify a Signing Certificate:

The default ‘Development’ and ‘Run Locally’ options are insufficient.  The easy way to do this, is after having added Keychain Sharing, add an App Group.  This will trigger the signing certificate selection procedure. 

We need access to the Keychain, so the Hardened Runtime checks are activated by the system to validate the accessing binary signatures.  In theory, the Hardened Runtime > Disable Library Validation setting ought to circumvent this, but this does not seem to be the case in Xcode 11.3.1.

For apps with Manual Signing

Add a macOS Provisioning Profile.

  • Step 1: Go to your Apple Developer Account Page
  • Step 2: Go to Certificates, Identifiers & Profiles -> Identifiers
  • Step 3: Select the app id of your project
  • Step 4: Edit the app id configurations. Search for Capability with name Mac Catalyst
  • Step 5: Enable Mac Catalyst and Configure the Mac Catalyst Capability and Choose Automatically create an identifier. Save changes
  • Step 6: Create a macOS Provisioning Profile with this app id. Download and import this provisioning profile
  • Step 7: Verify that Provisioning Profile is set correctly

The signing certificate is selected as part of Provisioning profile generation step. 

In case of multiple Signing Certificates

In case multiple certificates are found in your keychain for identity Apple Development, follow the steps below :
  • Step 1: Create a user-defined build setting in Xcode with name DEVELOPER_SIGNING_CERTIFICATE
  • Step 2: Enter the value of the setting DEVELOPER_SIGNING_CERTIFICATE with the Common Name of the certificate. If the Common Name isn’t unique, use SHA-1 fingerprint
  • Step 3: If using Common Name, go to your Keychain Access->login. Select the required certificate->Get Info. Copy the Common Name value
  • Step 4: If using SHA-1 fingerprint, go to your Keychain Access->login. Select the required certificate->Get Info. Copy the SHA-1 fingerprint value
  • Step 5: Paste this copied value to the build setting DEVELOPER_SIGNING_CERTIFICATE created above

You should be able to build for Mac target, without a script error.

 

2. Launch the Application on Mac

Select My Mac as destination and click Run.

 

 

 

That’s it. Your iPhone or iPad app is now running on Mac Catalyst!

 

Enable Mac Catalyst support on an existing iPhone or iPad app

For an existing iPhone or iPad app, you can follow these steps:

  1. Replace frameworks with XCFrameworks: Export the latest XCFrameworks using the Export Frameworks option in the Assistant menu. Replace the existing .frameworks in the project with the .xcframework
  1. Enable the app target to run on Mac
  1. Create a code signing script: Export the Code Signing Script using the Export Code Signing Script feature from the Assistant.

 

 

Copy the exported script to the ./scripts directory under the Xcode project. Add “python ./scripts/codesign.py” as a new build phase to the application target.

All the pre-requisite steps need to be fulfilled as before.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.