devicectl appIcon command not working

Hi, I'm trying to use the appIcon command of devicectl. I'm connecting to an iPhone 14 Pro running iOS 17.0.2.

xcrun devicectl device info appIcon --help

OVERVIEW: Request app icon generation from this device.

This command searches for an app installed on this device and requests for its icon to be generated.

USAGE: devicectl device info appIcon [<options>] --device <uuid|ecid|udid|name> --allow-placeholder <allow placeholder> --width <width> --height <height> --scale <scale>

DEVICE OPTIONS:
  -d, --device <uuid|ecid|udid|name>
                          The identifier, ECID, UDID, or name of the device.

COMMAND OPTIONS:
  --app-bundle-id <app bundle identifier>
                          Look for app icon information with the given application bundle identifier on device.
        Note: If both app-bundle-id and app-path are provided, only app-path will be used.
  --app-path <app path>   Look for app icon information at the given application path on device.
        Note: If both app-bundle-id and app-path are provided, only app-path will be used.
  --allow-placeholder <allow placeholder>
                          Allow placeholder icons to be generated.
        Note: Passing `true` will allow placeholder icons to be returned. Allowing placeholder icons will ensure no I/O is done on device. If you want to make sure you get the icon
        most accurate to your request -- which could use more resources on the device -- set this to `false`.
  --width <width>         Request app icon generation with the specified width.
  --height <height>       Request app icon generation with the specified height.
  --scale <scale>         Request app icon generation with the specified scale.
  --destination <destination>
                          Write the image (in png format) to the provided file on the host device.

OUTPUT OPTIONS:
  -v, --verbose           If given, provide more logging output than normal.
  -q, --quiet             If given, output will include only errors.
  -t, --timeout <seconds> The overall command timeout in seconds. If this limit is exceeded the command is abandoned as a failure.
  -j, --json-output <path>
                          An optional path to write a JSON file with command results.
        Note: JSON output to a user-provided file on disk is the ONLY supported interface for scripts/programs to consume command output.
  -l, --log-output <path> An optional path to write all logging otherwise passed to stdout/stderr.

OPTIONS:
  --version               Show the version.
  -h, --help              Show help information.

I've tried multiple variations of parameters and both apple-bundle-id and app-path, but always receive an error.

xcrun devicectl device info appIcon --device *** --app-bundle-id *** --app-path *** --allow-placeholder true --width 60 --height 60 --scale 3 --destination icon.png -j icon.json -t 10 -v

With JSON output

  "error" : {
    "code" : 6007,
    "domain" : "com.apple.dt.CoreDeviceError",
    "userInfo" : {
      "NSLocalizedDescription" : {
        "string" : "CGImage was nil when attempting to write to a destination."
      }
    }
  },

Without JSON output

09:32:42  Acquired tunnel connection to device.
09:32:42  Enabling developer disk image services.
09:32:42  Acquired usage assertion.
Application Icon Image Information
• Is Placeholder - false
• Size
    • Height - 0.0
    • Width - 0.0
• Scale - 0.0
• Pixel Size
    • Height - 0.0
    • Width - 0.0

Has anyone managed to successfully extract an app icon using devicectl?

well

Same here before, but now the xcrun devicectl device info appIcon command succeeds on the following environment.

  • macOS Sonoma 14.1 (23B74)
  • Xcode 15.0.1
  • iOS 17.0.3
$ xcrun devicectl device info appIcon --device  <device_id>  --app-bundle-id  <bundle_id> --width 512 --height 512 --scale 3 --destination appIcon.png --allow-placeholder true

09:42:00  Acquired tunnel connection to device.
09:42:00  Enabling developer disk image services.
09:42:00  Acquired usage assertion.
Application Icon Image Information
• Image file written to - <a file path>
• Is Placeholder - false
• Size
    • Height - 176.0
    • Width - 176.0
• Scale - 3.0
• Pixel Size
    • Height - 528.0
    • Width - 528.0

Thanks for sharing @SCENEE I've just updated to macOS Sonoma and the command works for me now too!

  • macOS Sonoma 14.1.1
  • Xcode 15.0.1
  • iOS 17.0.3

However... icons smaller than 1024x1024 are not extracted correctly.

Unfortunately, it seems that the appIcon command has broken again.

  • macOS Sequoia 15.0
  • Xcode 16.0 (16A242d)
  • iOS 17.6.1

Any kind of combination of arguments results in: "ERROR: CGImage was nil when attempting to write to a destination. (com.apple.dt.CoreDeviceError error 6007 (0x1777))"

This is the same error code and description as my original post.

Edit: I've filed bug report FB15372764 for both issues.

Edit II: Just updated to iOS 18.0 and the appIcon works again. It still has the pixel offset :-( except for 1024x1024 size.

devicectl appIcon command not working
 
 
Q