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 supportindexorclearparameters - ⚠️
_extract_element_coordinates_by_index()- Not implemented
IOSTools.__init__
urlstr - iOS Portal app URL (e.g., “http://192.168.1.100:8080”)bundle_identifiersList[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
indexint - 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:
indexint - Element index
str- Result message
IOSTools.swipe
start_xint - Starting X coordinatestart_yint - Starting Y coordinateend_xint - Ending X coordinateend_yint - Ending Y coordinateduration_msint - 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_msparameter ignored by iOS API
IOSTools.drag
start_xint - Starting X coordinate (unused)start_yint - Starting Y coordinate (unused)end_xint - Ending X coordinate (unused)end_yint - Ending Y coordinate (unused)duration_msint - Duration in milliseconds (unused)
bool- Always False
IOSTools.input_text
index or clear parameters.
Arguments:
textstr - 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
indexorclearparameters (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
keycodeint - iOS keycode
str- Result message
- Limited to hardware keys only
- Most navigation uses gestures or UI elements
App Management Methods
IOSTools.start_app
packagestr - Bundle identifier (e.g., “com.apple.MobileSMS”)activitystr - 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
activityparameter ignored
IOSTools.list_packages
include_system_appsbool - 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
informationstr - 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
successbool - Task success statusreasonstr - 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