我正在尝试使用devicectl的appIcon命令。我正在连接到运行 iOS 17.0.2 的 iPhone 14 Pro。
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.
我尝试了参数的多种变体以及 apple-bundle-id 和 app-path,但总是收到错误。
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
具有 JSON 输出
"error" : {
"code" : 6007,
"domain" : "com.apple.dt.CoreDeviceError",
"userInfo" : {
"NSLocalizedDescription" : {
"string" : "CGImage was nil when attempting to write to a destination."
}
}
},
没有 JSON 输出
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
如何使用devicectl成功提取应用程序图标?
升级后:
devicectl
命令有效。
但是,对于小于 1024x1024 的图标,像素会错位。在我看来,这像是苹果这边的一个错误。