NSUbiquitousKeyValueStore can no longer set a nil value for a key (Swift 3, Xcode8.0b2)

Originator:arthur
Number:rdar://27248454 Date Originated:July 8, 2016
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 8.0b2
Classification:Serious Bug Reproducible:Always
 
Summary:
In Swift 3, the following code does not work:

NSUbiquitousKeyValueStore.default().set(nil, forKey: key). 

An "Ambiguous use of set(_ forKey:)" warning is thrown.

Unfortunately, this is a bug, as in Swift 2, one could set nil to a key.

Even the documentation for NSUbiquitousKeyValueStore states you can do it. Here's the signature:

public func set(_ anObject: AnyObject?, forKey aKey: String)

Steps to Reproduce:
1. Open a Playgorund in Xcode 8.0b2
2. Type in NSUbiquitousKeyValueStore.default().set(nil, forKey: key). 
3. "Ambiguous use of set(_ forKey:)" warning is thrown

Expected Results:
No warning. Code should compile.

Actual Results:
"Ambiguous use of set(_ forKey:)" warning is thrown

Version:
Xcode 8.0b2

Notes:


Configuration:


Attachments

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!