Skip to main content

Error Code Handling

1. Check API Return Values

All API calls should check return values:

2. Common Error Codes

According to API documentation, main error codes:
  • 0: Success
  • -1: Engine not initialized

Handle Image Data

1. Input Image Validation

2. Image Processing Error Handling

3. Memory Management

Logging and File Operations

1. Log Configuration Error Handling

2. File Write Error Handling

Exception Handling

1. Catch and Handle Exceptions

2. Retry Mechanism

Debugging Tips

1. Error Information Collection

2. Performance Monitoring

Summary

Following these error handling best practices can help you:
  1. Improve App Stability: Through API return value checking and exception handling
  2. Improve User Experience: Through friendly error prompts and recovery mechanisms
  3. Facilitate Problem Troubleshooting: Through detailed logging and error information collection
  4. Optimize Performance: Through reasonable error recovery strategies and resource management
Remember to adjust error handling logic based on actual SDK error code definitions and continuously monitor and improve error handling mechanisms. The iOS platform uses ARC for automatic memory management, but still need to pay attention to avoiding circular references and releasing unnecessary resources timely.