利用 Facebook的idb(iOS Development
2023-10-31 本文已影响0人
子夜书案
安装 IOS Development Bridge
可以使用Homebrew来安装它:
brew tap facebook/fb
brew install idb-companion
pip3.6 install fb-idb
说明
- 需要 mac 系统,需要安装完成 xcode
- 需要 python3,版本>= 3.6
- 需要 iphone 通过 usb 连接 mac ,首次连接需要点信任
查看可用的设备
idb list-largets
能看到如下的信息,里面包含已经连接的设备和所有可用的模拟器:
iPad (10th generation) | 343D3A6B-FCE7-4E2D-9321-D3FCD15240C1 | Shutdown | simulator | iOS 16.2 | x86_64 | No Companion Connected
iPad (8th generation) | 4BAF835F-34FD-48F9-84C5-C4C3E965D234 | Shutdown | simulator | iOS 14.4 | x86_64 | No Companion Connected
iPad Air (4th generation) | 743E1B3C-CBC1-41FE-A8DB-F3BC5377DEA7 | Shutdown | simulator | iOS 14.4 | x86_64 | No Companion Connected
iPad Air (5th generation) | BAB256E2-6C6F-42B0-BBE7-B6A7B1FF5037 | Shutdown | simulator | iOS 16.2 | x86_64 | No Companion Connected
iPad Pro (11-inch) (2nd generation) | D4D50DF0-37D1-4430-90BB-86B87F6AEE10 | Shutdown | simulator | iOS 14.4 | x86_64 | No Companion Connected
iPad Pro (11-inch) (4th generation) | 9F0DCB3A-4613-4A3A-AFE7-E670F8748743 | Shutdown | simulator | iOS 16.2 | x86_64 | No Companion Connected
iPad Pro (12.9-inch) (4th generation) | C827C282-09BC-4A4C-890C-1BBF3C2C438F | Shutdown | simulator | iOS 14.4 | x86_64 | No Companion Connected
iPad Pro (12.9-inch) (6th generation) | 20379CD7-405D-4EF7-87C8-CBBD1F6FC57B | Shutdown | simulator | iOS 16.2 | x86_64 | No Companion Connected
iPad Pro (9.7-inch) | C7496BC1-43D1-430C-A1FD-F352CB9F2F41 | Shutdown | simulator | iOS 14.4 | x86_64 | No Companion Connected
安装和运行 ipa
连接:
idb connect your_udid
安装:
idb install --udid your_udid local_path.ipa
运行:
idb launch --udid your_udid your.bundle.id
在运行时,有可能会报错:
Failed to mount image
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/16.1/DeveloperDiskImage.dmg: 16.1',
this can occur when the wrong disk image is mounted for the target OS, or a disk image of the same type is already mounted.
- 可以自己去下载对应的镜像:访问地址
- 将下载好的 zip 解压,放到 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/ 目录
- 重启 xcode,或者重启电脑