Watch Device Name

I'm testing an app I'm developing on a real device: Watch Series 7 running watchOS 9.0.2. I have a WKExtensionDelegateAdaptor variable in the @main struct. I'm trying to print the name of the watch as found in Settings > General > About > Name. However, all I get is "Apple Watch" even though the name of the watch is "My Watch 7." I'm not sure if this has changed but not documented. Code is below:

import SwiftUI
@main
struct TheApp: App {
    @WKExtensionDelegateAdaptor private var extensionDelegate: ExtensionDelegate
    var body: some Scene {
        WindowGroup {
            HomeView()
        }
    }
}

import WatchKit
class ExtensionDelegate: WKExtensionDelegate {
     func applicationDidFinishLaunching() {
        print("Device name: \(WKInterfaceDevice.current().name)")
    }
}
Answered by Frameworks Engineer in 745690022

This is expected behaviour in watchOS 9 and newer. The documentation has now been updated.

We have run into the same issue on our Series 6 and Series 7 watches since the WatchOS 9 update. When running on a device with WatchOS 8, WKInterfaceDevice.current().name returns the expected device name (matching the one in Settings > General > About > Name). But when running on any WatchOS 9 version, it always returns "Apple Watch". We have also found that the correct name is returned in WatchOS 9 on the simulator, but not on physical devices.

We have noticed this with an older Storyboard-UI watch app where the device name has been working for a few years without incident. We also tested it with a small SwiftUI test case with the same results. It doesn't seem to matter which version of WatchOS 9 is used, even up through WatchOS 9.1.

I have a Feedback Assistant report in to Apple, however I have not gotten any response on it.

An update: I heard back from Apple in Feedback Assistant. It appears that they intentionally made this change with WatchOS 9 and iOS 16. Here is the reply I got from Apple: "Please know that this was an intentional change, and the documentation is being updated to reflect this. See https://developer.apple.com/documentation/uikit/uidevice/1620015-name for the analogous change in iOS."

It sounds like the default in WatchOS 9/iOS 16 is to return a generic device name unless you request an entitlement from Apple for your app to use the actual device name: https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_device-information_user-assigned-device-name

Accepted Answer

This is expected behaviour in watchOS 9 and newer. The documentation has now been updated.

Watch Device Name
 
 
Q