https://github.com/libimobiledevicehttps://github.com/libimobiledevicehttps://github.com/alibaba/taobao-iphone-devicehttps://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
.
Key |
Value |
BatteryCurrentCapacity |
100 |
BatteryIsCharging |
0 |
ExternalChargeCapable |
1 |
ExternalConnected |
1 |
FullyCharged |
1 |
GasGaugeCapability1 |
1 |
Domain: com.apple.disk_usage
Key |
Value |
AmountDataAvailable |
4294914048 |
AmountDataReserved |
209715200 |
CalculateDiskUsage |
"OkilyDokily"2 |
TotalDataAvailable |
4504629248 |
TotalDataCapacity |
29481025536 |
TotalDiskCapacity |
31708938240 |
TotalSystemAvailable |
335544320 |
TotalSystemCapacity |
2227912704 |
NANDInfo |
NSData... |
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
Key |
Value |
AmountCameraAvailable |
556707840 |
AmountCameraUsageChanged |
-58721 |
CalendarUsage |
311296 (/var/mobile/Library/Calendar ?) |
CameraUsage |
27063896 |
MediaCacheUsage |
0 (/tmp/MediaCache ?) |
MobileApplicationUsage |
5058054749 |
NotesUsage |
40960 (/var/mobile/Library/Notes ?) |
PhotoUsage |
6096396 |
VoicemailUsage |
28672 (/var/mobile/Library/Voicemail ?) |
WebAppCacheUsage |
600064 (/var/mobile/Library/Caches/com.apple.WebAppCache ?) |
Domain: com.apple.mobile.data_sync
Key |
Value |
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
Key |
Value |
Bookmarks |
{} |
Calendars |
{} |
Contacts |
{} |
DeviceHandlesDefaultCalendar |
1 |
DeviceSupportsClearingData |
1 |
Mail Accounts |
{ "ReadOnly" = 1 } |
Notes |
{} |
SupportsEncryptedBackups |
1 |
SyncSupportsCalDAV |
1 |
Domain: com.apple.mobile.lockdown_cache
Key |
Value |
ActivationState |
Activated |
Domain: com.apple.mobile.iTunes
Key |
Value |
64Bit |
3 |
AccessibilityLanguages |
("fr-CA","nl-BE", ...) |
AlbumArt |
(3013, {...}, 3018, {...}, ...) |
AppleDRMVersion |
{ Format = 2; Maximum = 4; Minimum = 0 } |
AudioCodecs |
{"AAC"={...}; "AIFF"={...}; ...} |
BatteryPollInterval |
60 |
ChapterImageSpecs |
(3006, {...}, 3013, {...}, ... }) |
ConnectedBus |
USB |
CustomerRingtones |
1 |
DBVersion |
5 |
FairPlayCBMaxVersion |
4 |
FairPlayCBMinVersion |
3 |
FairPlayCertificate |
NSData... |
FairPlayDeviceType |
94 |
FairPlayGUID |
888455bb1568888888809ca4c27ce2b648888 |
FairPlayID |
NSData... |
FamilyID |
10032 |
GeniusConfigMaxVersion |
20 |
GeniusConfigMinVersion |
1 |
GeniusMetadataMaxVersion |
20 |
GeniusMetadataMinVersion |
1 |
GeniusSimilaritiesMaxVersion |
20 |
GeniusSimilaritiesMinVersion |
1 |
HomeScreenIconColumns |
4 |
HomeScreenIconDockMaxCount |
6 |
HomeScreenIconHeight |
72 |
HomeScreenIconRows |
5 |
HomeScreenIconWidth |
72 |
HomeScreenMaxPages |
15 |
HomeScreenNewsstand |
1 |
HomeVideosSupported |
1 |
IconFolderColumns |
3 |
IconFolderMaxPages |
15 |
IconFolderRows |
3 |
IconStateSaves |
1 |
ImageSpecifications |
(901, {...}, 3141, {...}, ...) |
KeyTypeSupportVersion |
492 |
MinITunesVersion |
11.1.0 |
MinMacOSVersion |
10.5.8 |
NeedsAntiPhishingDB |
1 |
OEMA |
1 |
OEMID |
0 |
PhotoEventsSupported |
1 |
PhotoFacesSupported |
1 |
PhotoVideosSupported |
1 |
PlaylistFoldersSupported |
1 |
PodcastsSupported |
1 |
RentalsSupported |
1 |
Ringtones |
1 |
ScreenHeight |
2048 |
ScreenScaleFactor |
2 |
ScreenWidth |
1536 |
SupportedKeyboards |
("ar","bg_BG",...) |
SupportsAccessibility |
1 |
SupportsAirTraffic |
1 |
SupportsAlertTones |
1 |
SupportsAntiPhishing |
1 |
SupportsApplicationInstall |
1 |
SupportsConfigurationBlobs |
1 |
SupportsDownloadedPodcasts |
1 |
SupportsGenius |
1 |
SupportsGeniusMixes |
1 |
SupportsProvisioningBlobs |
1 |
SyncDataClasses |
("Contacts", "Calendars", ...) |
TVShowRentalsSupported |
1 |
UseVoiceMemosFolder |
1 |
VideoCodecs |
{"H.263" = {...}; "H.264" = {...}; ...} |
VideoPlaylistsSupported |
1 |
VoiceMemoFormats |
{"AAC"={...}; "AIFF"={...}; ...} |
VoiceMemosSupported |
1 |
iPhoneCheckpointVersion |
1 |
iTunesSetupComplete |
1 |
iTunesStoreCapable |
1 |
iTunesUSupported |
1 |
Domain: com.apple.mobile.restriction
Key |
Value |
ProhibitAppDelete |
0 |
ProhibitAppInstall |
0 |
Domain: com.apple.international
Key |
Value |
Locale |
en_AU |
Language |
en |
SupportedLocales |
("sv_AX", "ro_RO", ...) |
SupportedKeyboards |
("ar", "bg_BG", ...) |
SupportedLanguages |
("en", "fr", ..) |
/// Keyboard = "en_AU";
Domain: com.apple.xcode.developerdomain
Key |
Value |
DeveloperStatus |
Development |
Domain: com.apple.mobile.software_behavior
Key |
Value |
ChinaBrick |
0 |
GoogleMail |
0 |
NTSC |
0 |
NoVOIP |
0 |
NoWiFi |
0 |
ShutterClick |
0 |
Valid |
1 |
VolumeLimit |
0 |
Domain: com.apple.mobile.internal
Key |
Value |
CarrierBuild |
0 |
IsInternal |
0 |
UIBuild |
1 |
/// <PRE> /// VoidWarranty = ???; // not observed but deduced /// PasswordProtected = ???; // /// ActivationStateAcknowledged = ???; // /// </PRE>
Domain: com.apple.Accessibility
Key |
Value |
SpeakAutoCorrectionsEnabledByiTunes |
0 |
ZoomTouchEnabledByiTunes |
0 |
InvertDisplayEnabledByiTunes |
0 |
ClosedCaptioningEnabledByiTunes |
0 |
MonoAudioEnabledByiTunes |
0 |
VoiceOverTouchEnabledByiTunes |
0 |
Domain: com.apple.mobile.wireless_lockdown
These appear to relate to the wireless connection between the device and iTunes.
Key |
Value |
BonjourFullServiceName |
"ee:e8:ff:dd:4d:cc@fe80::eeee:ffff:4567._apple-mobdev2._tcp.local." |
EnableWifiConnections |
0 |
SupportsWifi |
1 |
SupportsWifiSyncing |
1 |
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