WKSnapshotRefreshBackgroundTask method setTaskCompleted(restoredDefaultState:estimatedSnapshotExpiration:userInfo:) should take estimatedSnapshotExpiration as Date?, not Date
| Originator: | jeff | ||
| Number: | rdar://29919499 | Date Originated: | 2017-01-08 |
| Status: | Closed | Resolved: | Behaves correctly |
| Product: | watchOS + SDK | Product Version: | watchOS 3.1 |
| Classification: | Reproducible: | Always |
The documentation for WKSnapshotRefreshBackgroundTask method setTaskCompleted(restoredDefaultState:estimatedSnapshotExpiration:userInfo:) parameter estimatedSnapshotExpiration says to "Use nil if the next snapshot needs to be scheduled as soon as possible." estimatedSnapshotExpiration is declared as Date, as opposed to an optional Date?, so passing nil is not possible. Apple Developer Relations: Engineering has the following feedback for you: That is on purpose. It was discussed during API review and decided that it is better to make developers think about this value than providing any default (there is no good default essentially). This value controls when you will next get to run as an app, so passing nil, which i would interrept as “I don’t care” seems invalid. You should care when you next run, even if you decide that is “never” you still care. The header for this method has a comment that explains this a little more. In this case, if this dev thinks their app should never run again then they follow this direction from that comment: “Use [NSDate distantFuture] if the snapshot doesn't need to be replaced.” Thank you for your feedback. Engineering has determined that this issue behaves as intended. We are now closing this bug report. If you just have questions about the resolution, then please update your bug report with that information so we can respond. My response: That sounds great, but please remove this line from the documentation if nil is not a valid parameter value: "Use nil if the next snapshot needs to be scheduled as soon as possible."
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!