UIKeyCommand discoverability title should be nullable

Originator:douglashill
Number:rdar://22209919 Date Originated:10 August 2014
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 9
Classification:Enhancement Reproducible:Always
 
Summary:
There are two methods for creating instances of UIKeyCommand, one with a discoverabilityTitle parameter and one without. It seems reasonable for calling the latter with a nil discoverability title to be equivalent to calling the first. Indeed this runs fine, but there is a nullability conversion warning.

Steps to Reproduce:
1. Make an iOS project in Xcode
2. Add code similar to this:

[UIKeyCommand keyCommandWithInput:UIKeyInputLeftArrow modifierFlags:0 action:@selector(goToPreviousPage:) discoverabilityTitle:[object methodThatReturnsANullableString]]

where methodThatReturnsANullableString is a method that returns `nullable NSString *`.

Or just try passing nil as the discoverabilityTitle.

Expected Results:
No warnings

Actual Results:
Warning: Implicit conversion from nullable pointer 'NSString * _Nullable' to non-nullable pointer type 'NSString * _Nonnull'

Version:
Xcode Version 7.0 beta 4 (7A165t)

Notes:
I checked the iOS 9.0 Beta 5 API Diffs and there appear to be no changes since beta 4.

Workaround: cast the argument as (NSString *).

Configuration:
Ran in iOS 9 Simulator, but the problem is with a compiler warning

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!