Starting with WatchOS 2, your WatchKit Extensions can run on an Apple Watch. Applications that run in this environment require the WatchConnectivity
framework to share data with their containing iOS app.
Starting with AdobeMobileLibrary
v4.6.0, WatchConnectivity
is supported.
Looking for information and documentation related to the Adobe Experience Platform Mobile SDK? Click here for our latest documentation.
As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform Mobile SDKs are configurable through Experience Platform Launch.
Ensure that you have a project with at least the following targets:
For more information about developing WatchKit apps, see The Watch App Architecture.
Complete the following steps in your Xcode project:
Drag the AdobeMobileLibrary
folder into your project.
Ensure that the ADBMobileConfig.json
file is a member of the containing app’s target.
In the Build Phases tab of your containing app’s target, expand the Link Binary with Libraries section and add the following libraries:
AdobeMobileLibrary.a
libsqlite3.tbd
SystemConfiguration.framework
In your class that implements the UIApplicationDelegate
protocol, add the WCSessionDelegate
protocol.
#import <WatchConnectivity/WatchConnectivity.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, WCSessionDelegate>
In the implementation file of your app delegate class, import the AdobeMobileLibrary
.
#import "ADBMobile.h"
Before making a call to the ADBMobile
library, in application:didFinishLaunchingWithOptions:
of your app delegate, configure your WCSession
.
// check for session availability
if ([WCSession isSupported]) {
WCSession *session = [WCSession defaultSession];
session.delegate = self;
[session activateSession];
}
In your app delegate, implement the session:didReceiveMessage:
and session:didReceiveUserInfo:
methods.
syncSettings:
is called in the ADBMobile
library, which returns a bool that indicates whether the dictionary was meant for consumption by the ADBMobile
library. If it returns No
, the message was not initiated from the Adobe SDK.
- (void) session:(WCSession *)session didReceiveMessage:(NSDictionary<NSString *,id> *)message {
// pass message to ADBMobile
if (![ADBMobile syncSettings:message]) {
// handle your own custom messages
}
}
- (void) session:(WCSession *)session didReceiveUserInfo:(NSDictionary<NSString *,id> *)userInfo {
// pass userInfo to ADBMobile
if (![ADBMobile syncSettings:userInfo]) {
// handle your own custom messages
}
}
Ensure that the ADBMobileConfig.json
file is a member of your WatchKit extension’s target.
In the Build Phases tab of your WatchKit extension’s target, expand the Link Binary with Libraries section and add the following libraries:
AdobeMobileLibrary_Watch.a
libsqlite3.tbd
In your class that implements the WKExtensionDelegate
protocol, import WatchConnectivity
and add the WCSessionDelegate
protocol.
#import <WatchConnectivity/WatchConnectivity.h>
@interface ExtensionDelegate : NSObject <WKExtensionDelegate, WCSessionDelegate>
In the implementation file of your extension delegate class, import the AdobeMobileLibrary
.
#import "ADBMobile.h"
In applicationDidFinishLaunching
of your extension delegate, configure your WCSession
before making any calls to the ADBMobile
library.
// check for session availability
if ([WCSession isSupported]) {
WCSession *session = [WCSession defaultSession];
session.delegate = self;
[session activateSession];
}
In applicationDidFinishLaunching
of your extension delegate, initialize the watch app for the SDK.
[ADBMobile initializeWatch];
In your extension delegate, implement the session:didReceiveMessage:
and session:didReceiveUserInfo:
methods.
syncSettings:
is called in the ADBMobile
library, which returns a bool that indicates whether the dictionary was meant for consumption by the ADBMobile
library. If it returns NO
, the message was not initiated from the Adobe SDK.
- (void) session:(WCSession *)session didReceiveMessage:(NSDictionary<NSString *,id> *)message {
// pass message to ADBMobile
if (![ADBMobile syncSettings:message]) {
// handle your own custom messages
}
}
- (void) session:(WCSession *)session didReceiveUserInfo:(NSDictionary<NSString *,id> *)userInfo {
// pass userInfo to ADBMobile
if (![ADBMobile syncSettings:userInfo]) {
// handle your own custom messages
}
}
Remember the following information:
a.RunMode
will be set to Extension
.a.AppID
.