watchOS app extension integration

Integrating Appfigurate Library into watchOS app extensions

watchOS apps can be developed in both Swift and Objective-C.

Appfigurate Library works in most types of watchOS app extensions.

Prerequisites

You must perform the following before starting watchOS app extension integration:

Add AppfigurateLibrary.xcframework to the watchOS app extension target

In Xcode, tap on your watchOS app extension target.

Tap the General tab. Tap the + button under the Frameworks, Libraries section.

Select AppfigurateLibrary package.

Share the watchOS app APLConfiguration subclass with the watchOS app extension

Share the watchOS app's APLConfiguration subclass with the watchOS app extension.

Open your APLConfiguration subclass (e.g. Configuration.swift/m file) into the Xcode editor.

In the Target Membership inspection pane tick on your watchOS app extension target.

Setup Keychain Sharing in the watchOS app extension

Tap on your watchOS app extension target.

Tap the Signing & Capabilities tabs. Add a Keychain Sharing capability with a Keychain Groups value that will be common across the watchOS app and watchOS app extension.

We recommend you have a .shared suffix on your Keychain Groups value.

Setup Keychain Sharing in the watchOS app

Tap on your watchOS app target. Tap Signing & Capabilities tabs.

Add a Keychain Sharing capability with the same Keychain Groups value you entered for the iOS app extension above.

Edit Info.plist in the watchOS app

In your watchOS app's Info.plist file (right click, Open AsSource Code) include the APLKeychainAccessGroup key replacing the value nz.co.electricbolt.appfigurateexample.shared with your Keychain Sharing's Keychain Groups value.

Info.plist example

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>APLKeychainAccessGroup</key>
     <string>nz.co.electricbolt.appfigurateexample.shared</string>
     ...

If the APLKeychainAccessGroup key is not defined, then keychain access group functionality is not used. Do not specify an empty or otherwise invalid APLKeychainAccessGroup value.

watchOS app extensions automatically use the Info.plist file from the containing watchOS app. You do not need to modify the watchOS app extension's Info.plist file.

Last updated