zoukankan      html  css  js  c++  java
  • libimobiledevice命令&ios-deploy命令

    ios-deploy

    1、安装ios-deploy

    brew install node
    npm install -g ios-deploy
    

    2、ios-deploy常用命令

    2.1 查看连接的设备(包括通过usb和wifi连接的)

    ios-deploy -c
    

    2.2 查看通过usb连接的设备

    ios-deploy -c --no-wifi
    

    2.3 安装应用到指定设备(其中xxx.app是Xcode编译后的ipa的路径)

    ios-deploy --id [udid] --bundle [xxx.app]
    

    2.4 卸载指定设备上的应用(根据包名,也就是bundleId)

    ios-deploy --id [udid] --uninstall_only --bundle_id [bundleId]
    

    2.5 查看指定设备上安装的所有应用(包括系统应用和第三方)

    ios-deploy --id [udid] --list_bundle_id
    

    2.6 检查指定设备上是否安装了某个应用

    ios-deploy --id [udid] --exists --bundle_id
    

    3. ios-deploy的帮助项(Option):

     -d, --debug                  launch the app in lldb after installation
      -i, --id <device_id>         the id of the device to connect to
      -c, --detect                 only detect if the device is connected
      -b, --bundle <bundle.app>    the path to the app bundle to be installed
      -a, --args <args>            command line arguments to pass to the app when launching it
      -t, --timeout <timeout>      number of seconds to wait for a device to be connected
      -u, --unbuffered             don't buffer stdout
      -n, --nostart                do not start the app when debugging
      -I, --noninteractive         start in non interactive mode (quit when app crashes or exits)
      -L, --justlaunch             just launch the app and exit lldb
      -v, --verbose                enable verbose output
      -m, --noinstall              directly start debugging without app install (-d not required)
      -p, --port <number>          port used for device, default: dynamic
      -r, --uninstall              uninstall the app before install (do not use with -m; app cache and data are cleared) 
      -9, --uninstall_only         uninstall the app ONLY. Use only with -1 <bundle_id> 
      -1, --bundle_id <bundle id>  specify bundle id for list and upload
      -l, --list                   list files
      -o, --upload <file>          upload file
      -w, --download               download app tree
      -2, --to <target pathname>   use together with up/download file/tree. specify target
      -D, --mkdir <dir>            make directory on device
      -R, --rm <path>              remove file or directory on device (directories must be empty)
      -V, --version                print the executable version 
      -e, --exists                 check if the app with given bundle_id is installed or not 
      -B, --list_bundle_id         list bundle_id 
      -W, --no-wifi                ignore wifi devices
      --detect_deadlocks <sec>     start printing backtraces for all threads periodically after specific amount of seconds
    

    libimobiledevice命令

    libimobiledevice 是一个跨平台的软件库,支持 iPhone®, iPod Touch®, iPad® and Apple TV® 等设备的通讯协议。
    安装命令:

    brew install --HEAD libimobiledevice
    brew install --HEAD ideviceinstaller
    

    PS:需要加上 –HEAD 选项,如果不加,安装是老版本,不支持iOS10的手机,所以安装时,需要加上 –HEAD 选项

    1.查看当前连接的设备

    idevice_id -l  #显示当前所连接的设备[udid],包括 usb、WiFi 连接
    

    2.安装应用

    ideviceinstaller -u [udid] -i [xxx.ipa]  #xxx.ipa:安装文件路径
    

    3.卸载应用

    ideviceinstaller -u [udid] -U [bundleId]    #bundleId:应用的包名
    

    4.查看安装的三方包

    ideviceinstaller -u [udid] -l # 指定设备,查看安装的第三方应用
    ideviceinstaller -u [udid] -l -o list_user # 指定设备,查看安装的第三方应用
    ideviceinstaller -u [udid] -l -o list_system # 指定设备,查看安装的系统应用
    ideviceinstaller -u [udid] -l -o list_all # 指定设备,查看安装的系统应用和第三方应用
    

    5.获取设备信息

    ideviceinfo -u [udid] # 指定设备,获取设备信息
    ideviceinfo -u [udid] -k DeviceName # 指定设备,获取设备名称:iPhone6s
    idevicename -u [udid] # 指定设备,获取设备名称:iPhone6s
    ideviceinfo -u [udid] -k ProductVersion # 指定设备,获取设备版本:10.3.1
    ideviceinfo -u [udid] -k ProductType # 指定设备,获取设备类型:iPhone8,1
    ideviceinfo -u [udid] -k ProductName # 指定设备,获取设备系统名称:iPhone OS
    

    6.查看日志

    idevicesyslog
    

    将log重定向到文件

    idevicesyslog >log.log
    

    查看日志

    tail -f log.log|grep 'time'
    

    7.重启

    idevicediagnostics restart

    8、idevicescreenshot截图

    //如果在使用截图的时候出现报错信息,那么就去把相应版本的DeveloperDiskImage的两个文件复制到libimobiledevice文件下面。
    
    路径:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/对应版本/
    
    获取版本号命令:
    ideviceinfo -k ProductVersion
    
    安装DeveloperDiskImage命令:
    ideviceimagemounter DeveloperDiskImage.dmg
    //然后就可以正常截图了
    

    9、遇到报错,解决方法:卸载重装

    brew uninstall ideviceinstaller
    brew uninstall libimobiledevice
    brew install --HEAD libimobiledevice
    brew install ideviceinstaller
    

    10、获取设备时间

    idevicedate
    

    11、获取设备信息

    ideviceinfo
    
  • 相关阅读:
    收藏文章整理
    关于java里的SimpleDateFormat使用
    手写MQ框架(四)-使用netty改造梳理
    JDK8中的ConcurrentHashMap源码
    JDK8中的HashMap源码
    手写MQ框架(三)-客户端实现
    手写MQ框架(二)-服务端实现
    Vue.js入门
    Tomcat启动找不到项目依赖jar的解决方式
    java课堂 动手动脑2
  • 原文地址:https://www.cnblogs.com/xidianzxm/p/14260640.html
Copyright © 2011-2022 走看看