IOSTools API Reference
IOSTools
- ⚠️
get_date()
- Not implemented - ⚠️
get_apps()
- Not implemented - ⚠️
drag()
- Not implemented - ⚠️
back()
- Not implemented (iOS has no universal back button) - ⚠️
input_text()
- Does not supportindex
orclear
parameters - ⚠️
_extract_element_coordinates_by_index()
- Not implemented
IOSTools.__init__
url
str - iOS Portal app URL (e.g., “http://192.168.1.100:8080”)bundle_identifiers
List[str] | None - Optional list of custom app bundle identifiers
- Install Droidrun iOS Portal app on device
- Launch Portal app (starts HTTP server)
- Connect device and computer to same network
- Use displayed URL to initialize IOSTools
UI Interaction Methods
IOSTools.tap_by_index
index
int - Element index from accessibility tree
str
- Result message with tapped element details
- Must call
get_state()
first to populate element cache - Returns error with available indices if index is invalid
- Waits 0.5s after tap for UI to update
IOSTools.tap
tap_by_index()
.
Arguments:
index
int - Element index
str
- Result message
IOSTools.swipe
start_x
int - Starting X coordinatestart_y
int - Starting Y coordinateend_x
int - Ending X coordinateend_y
int - Ending Y coordinateduration_ms
int - Duration in milliseconds (ignored on iOS)
bool
- True if successful, False otherwise
- iOS uses directional swipes, not precise coordinates
- Direction calculated from coordinate delta (largest axis wins)
duration_ms
parameter ignored by iOS API
IOSTools.drag
start_x
int - Starting X coordinate (unused)start_y
int - Starting Y coordinate (unused)end_x
int - Ending X coordinate (unused)end_y
int - Ending Y coordinate (unused)duration_ms
int - Duration in milliseconds (unused)
bool
- Always False
IOSTools.input_text
index
or clear
parameters.
Arguments:
text
str - Text to input (supports Unicode and newlines)
str
- Result message
- Must tap text field before calling this method
- Uses last tapped element’s rect for targeting
- Waits 0.5s after input
- No
index
orclear
parameters (unlike AdbTools)
IOSTools.back
NotImplementedError
.
iOS has no universal back button. Use navigation UI elements instead.
Raises:
NotImplementedError
- Always raised when called
IOSTools.press_key
0
- HOME button4
- ACTION button5
- CAMERA button
keycode
int - iOS keycode
str
- Result message
- Limited to hardware keys only
- Most navigation uses gestures or UI elements
App Management Methods
IOSTools.start_app
package
str - Bundle identifier (e.g., “com.apple.MobileSMS”)activity
str - Ignored on iOS (for API compatibility)
str
- Result message
- Messages:
com.apple.MobileSMS
- Safari:
com.apple.mobilesafari
- Settings:
com.apple.Preferences
- Mail:
com.apple.mobilemail
- Calendar:
com.apple.mobilecal
- Photos:
com.apple.mobileslideshow
- Maps:
com.apple.Maps
- Contacts:
com.apple.MobileAddressBook
- Waits 1s after launch
activity
parameter ignored
IOSTools.list_packages
include_system_apps
bool - Include system apps (default: True)
List[str]
- List of bundle identifiers
- Returns union of
bundle_identifiers
+ system apps - System apps: Settings, Safari, Messages, Mail, etc.
- Does not query device for installed apps
State and Screenshot Methods
IOSTools.get_state
a11y_tree
- List of interactive UI elementsphone_state
- Current activity and keyboard visibility
- Button, SearchField, TextField, Cell
- Switch, Slider, Stepper, Picker, Link
- Only interactive elements included
- Non-interactive elements filtered out
- More detailed than Android accessibility tree
IOSTools.take_screenshot
Tuple[str, bytes]
- (“PNG”, image_bytes)
- Stores screenshot with timestamp internally
- Used for trajectory recording
Memory and Completion Methods
IOSTools.remember
information
str - Information to remember
str
- Confirmation message
- Max 10 most recent items
- Persists during agent execution only
IOSTools.get_memory
List[str]
- Stored memory items
IOSTools.complete
success
bool - Task success statusreason
str - Required ifsuccess=False
Missing Methods
The following abstract methods fromTools
base class are not implemented:
get_date()
⚠️ Not implemented. Returns “Not implemented for iOS” or raises error.get_apps()
⚠️ Not implemented. Uselist_packages()
instead (returns bundle identifiers only).
_extract_element_coordinates_by_index()
⚠️ Not implemented. Usetap_by_index()
directly instead.
Instance Properties
iOS vs Android Differences
Feature | iOS | Android |
---|---|---|
Back button | ❌ Not available | ✅ Available |
Swipe | Direction-based | Coordinate-based |
Drag | ❌ Not implemented | ✅ Implemented |
App IDs | Bundle identifiers | Package names |
Key codes | 3 keys (HOME, ACTION, CAMERA) | Full Android keycodes |
Accessibility | Richer element data | Basic element data |
Connection | HTTP (Portal app) | ADB over USB/TCP |
get_date() | ❌ Not implemented | ✅ Implemented |
input_text() | No index/clear params | Full signature |
adb connect
+ Portal APK
iOS: Portal app + same network + HTTP connection
Limitations:
- HTTP only (no USB like Android)
- Direction-based gestures (not coordinate-precise)
- Fewer system controls
Example Usage
See Also
- AdbTools - Android device control with full functionality
- Tools Base Class - Abstract base class reference