WKSnapshotRefreshBackgroundTask setTaskCompletedWithDefaultStateRestored: documentation/headers do not match

Originator:rupey
Number:rdar://28464285 Date Originated:25-Sep-2016
Status:Open Resolved:
Product:watchOS SDK Product Version:3.0 (14S326)
Classification:Other Reproducible:Always
 
Summary:
The watchOS 3.0 documentation states the following parameter should be passed nil:

estimatedSnapshotExpiration
The preferred fire date for the next background snapshot refresh task. Use nil if the next snapshot needs to be scheduled as soon as possible. Use distantFuture if you do not want to schedule the next refresh.

(Source: https://developer.apple.com/reference/watchkit/wksnapshotrefreshbackgroundtask/1650844-settaskcompletedwithdefaultstate?language=objc)

However if you attempt to pass nil to this method, you get a compiler warning:

> Null passed to a callee that requires a non-null argument

The header in WatchKit.framework/WKBackgroundTask.h declares the method as:

- (void)setTaskCompletedWithDefaultStateRestored:(BOOL)restoredDefaultState
                     estimatedSnapshotExpiration:(NSDate *)estimatedSnapshotExpiration
                                        userInfo:(nullable id<NSSecureCoding>)userInfo

Steps to Reproduce:
1. Implement a WKExtensionDelegate class.
2. Implement handleBackgroundTasks: in the class
3. Try to call [snapshotTask setTaskCompletedWithDefaultStateRestored:YES estimatedSnapshotExpiration:nil userInfo:nil];
4. Compile the project, check for warnings

Expected Results:
Either the documentation should be updated to propose a way to set a request a background refresh snapshot task in an ASAP but indeterminate period of time, or the header should be changed to set the parameter as nullable.

Actual Results:
Compiler gives warning 'Null passed to a callee that requires a non-null argument'

Version:
3.0 (14S326)

Notes:


Configuration:
Xcode 8.0 (8A218a)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!