Skip to content

Commit 96f16d7

Browse files
enedclaude
andcommitted
fix: Make initialDelaySeconds optional in iOS registerOneOffTask
The iOS native implementation was requiring initialDelaySeconds as a non-null Int64, but the Dart API allows it to be optional. This was causing "Invalid parameters passed" errors in integration tests. Changed to use a default value of 0 when the parameter is not provided, matching the behavior of registerPeriodicTask and registerProcessingTask. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent d35e4d4 commit 96f16d7

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

workmanager_ios/ios/Classes/SwiftWorkmanagerPlugin.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,7 @@ extension SwiftWorkmanagerPlugin: FlutterPlugin {
310310

311311
if #available(iOS 13.0, *) {
312312
let method = ForegroundMethodChannel.Methods.RegisterOneOffTask.self
313-
guard let delaySeconds =
314-
arguments[method.Arguments.initialDelaySeconds.rawValue] as? Int64 else {
315-
result(WMPError.invalidParameters.asFlutterError)
316-
return
317-
}
313+
let delaySeconds = arguments[method.Arguments.initialDelaySeconds.rawValue] as? Int64 ?? 0
318314
guard let uniqueTaskIdentifier =
319315
arguments[method.Arguments.uniqueName.rawValue] as? String else {
320316
result(WMPError.invalidParameters.asFlutterError)

0 commit comments

Comments
 (0)