Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Meet CoreDevice and devicectl

Meet CoreDevice and devicectl

Presentation at potatotips #85 on 2023 Nov 14.

Shin Yamamoto

November 14, 2023
Tweet

More Decks by Shin Yamamoto

Other Decks in Programming

Transcript

  1. CoreDevice ৽͍͠σόΠε௨৴ελοΫ • Xcode 15͔Β • iOSɾiPadOSɾtvOS 17, watchOS 8.7.1

    and later • Xcodeͷ"Devices and Simulators”΢Πϯυ΢Ͱ࢖༻͞Ε͍ͯΔ • Apple Watch΋MacͱϫΠϠϨε઀ଓͰ͖Δ • Apple Vision ProΛݟਾ͑ͯ? From Xcode updates - Tuning and debugging as of 2023/11/14
  2. • list ίϚϯυ • σόΠεҰཡΛදࣔ͢Δ • DDIϦετΛऔಘ͢Δ • manage ίϚϯυ

    • σόΠεΛunpair/pair͢Δ • diagnose ίϚϯυ • CoreDeviceͷϩάΛऔಘ͢Δ • device ίϚϯυ • ΞϓϦίϯςφͷϑΝΠϧҰཡΛग़ྗ͢Δ • ΞϓϦΞΠίϯΛऔಘ͢Δ • ΞϓϦҰཡΛग़ྗ͢Δ • ϩοΫঢ়ଶ • ϓϩηεҰཡ • σόΠεৄࡉ • σΟεϓϨΠ࢓༷ • DDIαʔϏεҰཡ • ΞϓϦίϯςφ͔ΒϑΝΠϧΛίϐʔ͢Δ • ΞϓϦίϯςφ΁ϑΝΠϧΛίϐʔ͢Δ • ΞϓϦΛΠϯετʔϧɾΞϯΠϯετʔϧ ͢Δ • ୺຤Λ࠶ىಈ͢Δ
  3. • list ίϚϯυ • σόΠεҰཡΛදࣔ͢Δ • DDIϦετΛऔಘ͢Δ • manage ίϚϯυ

    • σόΠεΛunpair/pair͢Δ • diagnose ίϚϯυ • CoreDeviceͷϩάΛऔಘ͢Δ • device ίϚϯυ • ΞϓϦίϯςφͷϑΝΠϧҰཡΛग़ྗ͢Δ • ΞϓϦΞΠίϯΛऔಘ͢Δ • ΞϓϦҰཡΛग़ྗ͢Δ • ϩοΫঢ়ଶ • ϓϩηεҰཡ • σόΠεৄࡉ • σΟεϓϨΠ࢓༷ • DDIαʔϏεҰཡ • ΞϓϦίϯςφ͔ΒϑΝΠϧΛίϐʔ͢Δ • ΞϓϦίϯςφ΁ϑΝΠϧΛίϐʔ͢Δ • ΞϓϦΛΠϯετʔϧɾΞϯΠϯετʔϧ ͢Δ • ୺຤Λ࠶ىಈ͢Δ
  4. σόΠεҰཡΛදࣔ͢Δ xcrun devicectl list devices shin@mac % xcrun devicectl list

    devices Devices: Name Hostname Identifier S ------------- ------------------------------------------ ------------------------------------ - Apple Watch 5 00008006-0012F4DA1E47002E.coredevice.local 459D80BD-2C3E-402E-803E-B3CD1DB7C240 u iPhone 00008120-001134592E88C01E.coredevice.local 321B74B0-C97D-407F-B5FA-9FD9597CD28E u iPhone 11 Pro 00008030-000264A81110802E.coredevice.local 09DC7A7D-CA9C-446F-8D5E-ADB04AD3D5D4 a shin@mac %
  5. ΞϓϦίϯςφ಺ͷϑΝΠϧҰཡΛදࣔ͢Δ xcrun devicectl device info files shin@mac % xcrun devicectl

    device info files \ -—device 09DC7A7D-CA9C-446F-8D5E-ADB04AD3D5D4 \ -—domain-type appDataContainer \ --domain-identifier “example.Maps” \ -—username root 13 files: Name ----------------------------------------------------------------------------------------------------- .com.apple.mobile_container_manager.metadata.plist Library/Caches/com.apple.dyld/Maps.dyld4 Library/Caches/example.Maps/com.apple.metal/archiveUsage.db/data.mdb Library/Caches/example.Maps/com.apple.metal/archiveUsage.db/lock.mdb Library/Caches/example.Maps/com.apple.metal/functions.data Library/Caches/example.Maps/com.apple.metal/functions.list Library/Caches/example.Maps/com.apple.metal/libraries.data Library/Caches/example.Maps/com.apple.metal/libraries.list Library/Saved Application State/example.Maps.savedState/KnownSceneSessions/data.data ...
  6. ΞϓϦίϯςφ಺͔ΒϑΝΠϧΛίϐʔ͢Δ xcrun devicectl device copy from shin@mac % xcrun devicectl

    -v device copy from \ --device 09DC7A7D-CA9C-446F-8D5E-ADB04AD3D5D4 \ --domain-type appDataContainer \ --domain-identifier “com.example.myapp” \ --source “Documents/myapp.db” \ --destination tmp/myapp.db \ --user root Using verbose logging. 2023-11-13 21:50:06.534+0900 Acquired tunnel connection to device. 2023-11-13 21:50:06.572+0900 Enabling developer disk image services. 2023-11-13 21:50:06.642+0900 Acquired usage assertion. Received successful result from device: FileTransferResult(sessionRootPath: "/private/var/ mobile/Containers/Data/Application/0EE5E68F-E916-40F6-B599-1DD3C66419FE") for request D97625D1- EA6D-4990-82DD-A341BFCF049B Command Completed, took 1.201 seconds shin@mac % ls tmp local.db