On 14 Oct 2015, at 2:27 PM, Shane Stanley <sstan...@myriad-com.com.au> wrote:
> On 14 Oct 2015, at 1:33 PM, Graham Cox <graham....@bigpond.com> wrote: >> >> I’ve been passing nil forever, only now does Xcode 7 complain, presumably >> because only now is the _Nonnull attribute added. But either the >> documentation or the addition of _Nonnull is wrong. > > FWIW, I've had an open bug on this since July (#21667200). You might also > notice the docs say "dict can be nil", and there isn't a "dict" to be seen > (presumably it means docAttributes). Coming back to this, my bug has just been closed, with a pointer to: <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSAttributedString_AppKitAdditions/index.html#//apple_ref/doc/uid/TP40004007> And sure enough, where it once said: - (NSData * nullable)RTFFromRange:(NSRange)aRange documentAttributes:(NSDictionary<NSString *, id> * nonnull)docAttributes it now says: - (NSData *)RTFFromRange:(NSRange)aRange documentAttributes:(NSDictionary<NSString *, id> *)docAttributes The description is unchanged: > If there are no document-level attributes, dict can be nil. Great. However, when I look at the .h file, it's all wrapped in NS_ASSUME_NONNULL_BEGIN, and using the method with nil prompts exactly the same warning. So the contradiction between the documentation and actual behavior still stands, just not so obviously. All of which led me to also look at this in the same document: - (instancetype)initWithRTFD:(NSData *)rtfdData documentAttributes:(NSDictionary<NSString *, id> * _Nullable *)docAttributes for which the .h file (Xcode 7.2) actually says: - (nullable instancetype)initWithRTF:(NSData *)data documentAttributes:(NSDictionary<NSString *, id> * __nullable * __nullable)dict; Am I just being a pedant or is this all a bit hopeless? -- Shane Stanley <sstan...@myriad-com.com.au> <www.macosxautomation.com/applescript/apps/> _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com