Skip to content

Commit 0b976f4

Browse files
committed
add workaround
Close #36
1 parent b452672 commit 0b976f4

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,47 @@ try await exporter.export()
376376

377377
## Troubleshooting
378378

379+
### Error -11819 "Cannot Complete Action" (iOS 14.5+)
380+
381+
**Problem:** Export fails with `AVFoundationErrorDomain Code=-11819 "Cannot Complete Action"`, especially on iOS 14.5.
382+
383+
**Cause:** This is an **iOS system-level bug** where media daemons crash during export operations. It's not a library issue but an Apple bug that affects `AVAssetReader`/`AVAssetWriter` operations.
384+
385+
**Solutions:**
386+
387+
1. **Implement Retry Logic** (recommended):
388+
```swift
389+
func exportWithRetry(maxAttempts: Int = 3) async throws -> URL {
390+
var lastError: Error?
391+
392+
for attempt in 1...maxAttempts {
393+
do {
394+
let url = try await exporter.export()
395+
return url
396+
} catch let error as NSError where error.code == -11819 {
397+
lastError = error
398+
print("Attempt \(attempt) failed with -11819, retrying...")
399+
try await Task.sleep(nanoseconds: 500_000_000) // 0.5s delay
400+
continue
401+
} catch {
402+
throw error // Other errors, don't retry
403+
}
404+
}
405+
406+
throw lastError ?? NextLevelSessionExporterError.writingFailure("Export failed after \(maxAttempts) attempts")
407+
}
408+
```
409+
410+
2. **Reduce Complexity**: Lower resolution, bitrate, or remove video composition if using CoreAnimation tools
411+
412+
3. **Update iOS**: The issue is less frequent on iOS 15+
413+
414+
4. **Report to Apple**: File a Feedback Assistant report with sysdiagnose if this occurs frequently
415+
416+
**References:**
417+
- [Apple Forums Thread](https://developer.apple.com/forums/thread/679862)
418+
- [Radar: FB8815719](https://openradar.appspot.com/FB8815719)
419+
379420
### Export Fails with "Reading Failure"
380421

381422
**Problem:** Export fails when reading the source asset.

0 commit comments

Comments
 (0)