zoukankan      html  css  js  c++  java
  • ios 常用命令封装

    tidevice安装:pip3 install tidevice
    ideviceinstaller安装: 1.brew install --HEAD libimobiledevice
                   2.brew install ideviceinstaller

    import os

    class IOS:

    def __init__(self, log):
    self.log = log

    def getdeviceslist(self)->list:
    """获取设备列表"""
    all_devices = []
    cmd = "tidevice list"
    reslut = os.popen(cmd).readlines()
    for item in reslut:
    if item != " ":
    all_devices.append(str(item).split(" ")[0].split(' ')[0])
    return all_devices

    def isinstallipa(self, packname: str, devices: str) -> bool:
    """
    是否安装ipa包
    :param packname: ipa包 路径
    :param devices: 设备ID
    :return:
    """
    cmd = "tidevice --udid {} applist".format(devices)
    reslut = os.popen(cmd).readlines()
    all_apkname = []
    for i in reslut:
    apkname = str(i).split(' ')[0]
    all_apkname.append(apkname)
    if packname in all_apkname:
    return True
    return False

    def uninstallipa(self, packname: str, devices: str) -> bool:
    """
    卸载
    :param packname: ipa包 路径
    :param devices: 设备ID
    :return:
    """
    reslut = self.isinstallipa(packname, devices)
    if reslut:
    cmd = 'tidevice --udid %s uninstall %s ' % (devices, packname)
    os.system(cmd)
    return True
    return False


    def installipa(self, paknamepath: str, devices: str) -> bool:
    """
    安装
    :param paknamepath: ipa包 路径
    :param devices: 设备ID
    :return:
    """
    cmd = 'tidevice --udid %s install %s' % (devices, paknamepath)
    os.system(cmd)
    return True

    def get_uuid(self):
    """获取uuid"""
    return str(os.popen('idevice_id -l').read()).replace(" ", "")

    def get_platform_version(self):
    """获取设备信息"""
    return str(os.popen('ideviceinfo -k ProductVersion').read()).replace(" ", "")

    def get_device_name(self):
    """"""
    UDID = self.get_uuid()
    device_name = os.popen('ideviceinfo -u %s -k DeviceName' % (UDID)).read()
    return str(device_name).replace(" ", "")
    学习最大的乐趣在于分享,我是绝世老中医,欢迎来诊 个人qq:1978529954
  • 相关阅读:
    冲刺——第三天
    冲刺——第二天
    梦断代码前三章略有感想
    四则运算法则设计思路
    第一期阅读计划
    软件工程概论第一次课堂小测-------产生30个100以内的随机整数四则运算的小程序
    软件演化
    软件测试
    软件实现
    面向对象设计
  • 原文地址:https://www.cnblogs.com/jueshilaozhongyi/p/15146901.html
Copyright © 2011-2022 走看看