https://github.com/libimobiledeviceicon-default.png?t=LA92https://github.com/libimobiledevicehttps://github.com/alibaba/taobao-iphone-deviceicon-default.png?t=LA92https://github.com/alibaba/taobao-iphone-device

iOS真机命令(自动化测试)
获取设备的的UDID
idevice_id --list # 显示当前所连接设备的 udid 
ideviceinfo 可以在返回的数据中找到 udid
idevice_id -l
苹果手机 safari打开网址http://fir.im/udid 就看到了
安装某个app
ideviceinstaller -i apppath 安装apppath下的app
ideviceinstaller -u [udid] -i [xxx.ipa] # xxx.ipa 为应用在本地的路径
卸载应用
ideviceinstaller -u [udid] -U [bundleId]
查看设备已安装的应用
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 # 查看设备安装的所有应用
获取设备信息
ideviceinfo -u [udid] # 获取设备信息
ideviceinfo -u [udid] -k DeviceName # 获取设备名称 同命令 idevicename
idevicename # 同上
ideviceinfo -u [udid] -k ProductVersion # 获取设备版本 10.3.3
ideviceinfo -u [udid] -k ProductType # 获取设备类型 iPhone 8,1
ideviceinfo -u [udid] -k ProductName # 获取设备系统名称
其他系统文件信息
ideviceinfo # 获取设备所有信息
idevicesyslog # 获取设备日志
idevicecrashreport -e test # 获取设备 crashlog,test 是文件夹需新建
idevicediagnostics # 管理设备状态 - 重启、关机、睡眠等
ios-deploy 常用命令
ios-deploy -c # 查看当前链接的设备
ios-deploy --[xxx.app] # 安装APP
ios-deploy --id [udid] --uninstall_only --bundle_id [bundleId] # 卸载应用
ios-deploy --id [udid] --list_bundle_id # 查看所有应用
ios-deploy --id [udid] --exists --bundle_id # 查看应用是否安装
列举设备安装的应用:
ideviceinstaller -l则可以列出手机上所有的用户安装的app
运行某个app
idevicedebug run 'APP_BUNDLE_ID’可以直接launch某个app,当然,这个app必须是你通过development证书build到手机上的才行。
获取手机的设备版本:
Ideviceinfo -k ProductVersion
获取手机的设备名:
ideviceinfo -k ProductType
截图:
idevicescreenshot 
手机关机:idevicediagnostics shutdown # shutdown device
重启手机:idevicediagnostics restart # restart device
休眠(熄屏灭屏): idevicediagnostics sleep # 类似于断开adb . (disconnects from host)

Domain: com.apple.mobile.battery

I believe this superceded com.apple.springboard.curvedBatteryCapacity.

KeyValue
BatteryCurrentCapacity100
BatteryIsCharging0
ExternalChargeCapable1
ExternalConnected1
FullyCharged1
GasGaugeCapability11

Domain: com.apple.disk_usage

KeyValue
AmountDataAvailable4294914048
AmountDataReserved209715200
CalculateDiskUsage"OkilyDokily"2
TotalDataAvailable4504629248
TotalDataCapacity29481025536
TotalDiskCapacity31708938240
TotalSystemAvailable335544320
TotalSystemCapacity2227912704
NANDInfoNSData...

These have been observed in the past, but I don't see them any more on an iPad Air (ios7) or an iPod Touch (ios6), though there are some clues still visible inside /usr/libexec/lockdownd

KeyValue
AmountCameraAvailable556707840
AmountCameraUsageChanged-58721
CalendarUsage311296 (/var/mobile/Library/Calendar ?)
CameraUsage27063896
MediaCacheUsage0 (/tmp/MediaCache ?)
MobileApplicationUsage5058054749
NotesUsage40960 (/var/mobile/Library/Notes ?)
PhotoUsage6096396
VoicemailUsage28672 (/var/mobile/Library/Voicemail ?)
WebAppCacheUsage600064 (/var/mobile/Library/Caches/com.apple.WebAppCache ?)

Domain: com.apple.mobile.data_sync

KeyValue
Bookmarks{...}
Calendars{...}
Contacts{...}
Notes{...}

Each of the values is a subdictionary with a similiar set of keys. For example,< PRE> Notes = AccountNames = ( iCloud ); Sources = ( "com.apple.dataaccess.IMAPNotes", iCloud ); }< /PRE>

Domain: com.apple.mobile.sync_data_class

KeyValue
Bookmarks{}
Calendars{}
Contacts{}
DeviceHandlesDefaultCalendar1
DeviceSupportsClearingData1
Mail Accounts{ "ReadOnly" = 1 }
Notes{}
SupportsEncryptedBackups1
SyncSupportsCalDAV1

Domain: com.apple.mobile.lockdown_cache

KeyValue
ActivationStateActivated

Domain: com.apple.mobile.iTunes

KeyValue
64Bit3
AccessibilityLanguages("fr-CA","nl-BE", ...)
AlbumArt(3013, {...}, 3018, {...}, ...)
AppleDRMVersion{ Format = 2; Maximum = 4; Minimum = 0 }
AudioCodecs{"AAC"={...}; "AIFF"={...}; ...}
BatteryPollInterval60
ChapterImageSpecs(3006, {...}, 3013, {...}, ... })
ConnectedBusUSB
CustomerRingtones1
DBVersion5
FairPlayCBMaxVersion4
FairPlayCBMinVersion3
FairPlayCertificateNSData...
FairPlayDeviceType94
FairPlayGUID888455bb1568888888809ca4c27ce2b648888
FairPlayIDNSData...
FamilyID10032
GeniusConfigMaxVersion20
GeniusConfigMinVersion1
GeniusMetadataMaxVersion20
GeniusMetadataMinVersion1
GeniusSimilaritiesMaxVersion20
GeniusSimilaritiesMinVersion1
HomeScreenIconColumns4
HomeScreenIconDockMaxCount6
HomeScreenIconHeight72
HomeScreenIconRows5
HomeScreenIconWidth72
HomeScreenMaxPages15
HomeScreenNewsstand1
HomeVideosSupported1
IconFolderColumns3
IconFolderMaxPages15
IconFolderRows3
IconStateSaves1
ImageSpecifications(901, {...}, 3141, {...}, ...)
KeyTypeSupportVersion492
MinITunesVersion11.1.0
MinMacOSVersion10.5.8
NeedsAntiPhishingDB1
OEMA1
OEMID0
PhotoEventsSupported1
PhotoFacesSupported1
PhotoVideosSupported1
PlaylistFoldersSupported1
PodcastsSupported1
RentalsSupported1
Ringtones1
ScreenHeight2048
ScreenScaleFactor2
ScreenWidth1536
SupportedKeyboards("ar","bg_BG",...)
SupportsAccessibility1
SupportsAirTraffic1
SupportsAlertTones1
SupportsAntiPhishing1
SupportsApplicationInstall1
SupportsConfigurationBlobs1
SupportsDownloadedPodcasts1
SupportsGenius1
SupportsGeniusMixes1
SupportsProvisioningBlobs1
SyncDataClasses("Contacts", "Calendars", ...)
TVShowRentalsSupported1
UseVoiceMemosFolder1
VideoCodecs{"H.263" = {...}; "H.264" = {...}; ...}
VideoPlaylistsSupported1
VoiceMemoFormats{"AAC"={...}; "AIFF"={...}; ...}
VoiceMemosSupported1
iPhoneCheckpointVersion1
iTunesSetupComplete1
iTunesStoreCapable1
iTunesUSupported1

Domain: com.apple.mobile.restriction

KeyValue
ProhibitAppDelete0
ProhibitAppInstall0

Domain: com.apple.international

KeyValue
Localeen_AU
Languageen
SupportedLocales("sv_AX", "ro_RO", ...)
SupportedKeyboards("ar", "bg_BG", ...)
SupportedLanguages("en", "fr", ..)

/// Keyboard = "en_AU";

Domain: com.apple.xcode.developerdomain

KeyValue
DeveloperStatusDevelopment

Domain: com.apple.mobile.software_behavior

KeyValue
ChinaBrick0
GoogleMail0
NTSC0
NoVOIP0
NoWiFi0
ShutterClick0
Valid1
VolumeLimit0

Domain: com.apple.mobile.internal

KeyValue
CarrierBuild0
IsInternal0
UIBuild1

/// <PRE> /// VoidWarranty = ???; // not observed but deduced /// PasswordProtected = ???; // /// ActivationStateAcknowledged = ???; // /// </PRE>

Domain: com.apple.Accessibility

KeyValue
SpeakAutoCorrectionsEnabledByiTunes0
ZoomTouchEnabledByiTunes0
InvertDisplayEnabledByiTunes0
ClosedCaptioningEnabledByiTunes0
MonoAudioEnabledByiTunes0
VoiceOverTouchEnabledByiTunes0

Domain: com.apple.mobile.wireless_lockdown

These appear to relate to the wireless connection between the device and iTunes.

KeyValue
BonjourFullServiceName"ee:e8:ff:dd:4d:cc@fe80::eeee:ffff:4567._apple-mobdev2._tcp.local."
EnableWifiConnections0
SupportsWifi1
SupportsWifiSyncing1

WirelessBuddyID appears to be a dynamic value. Its format is as a <uuid> and it appears that the MobileDevice.framework retrieves it from CFPreferences("com.apple.iTunes","WirelessBuddyID"), allocating a new one if it does not already exist.

AMDeviceSetWirelessBuddyFlags() seems to push the hosts value across into the device, when it sets EnableWifiConnections to True.

 

查询手机空间

 Ideviceinfo -q com.apple.disk_usage |findstr Data

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐