If you're using NS_ASSUME_NONNULL
you can get away with:
withError:(NSError *__nullable*)

It's an outError (out parameter) which in C parlance is a pointer to a pointer.
By convention it is a pointer to a pointer declared as NSError type but set to 
nil.
It's easy to forget, so I keep a snippet in Xcode triggered by the keyword 
outError to fill it in for me.

My snippet predates things a bit and might be overkill with
error:(out NSError * __nullable __autoreleasing * __nullable)outError

But I copied it from Apple frameworks, I believe NSFileManager, some time back.
The second nullable means you can just pass nil meaning you don't want the 
error back at all, though that's probably fallen out of fashion.
out is as I recall just a helper to the compiler.

> On Jun 16, 2016, at 11:57 PM, Dave <d...@looktowindward.com> wrote:
> 
>> You probably added a “nullable” or “__nullable” attribute somewhere else in 
>> that header. If you do that, the compiler enables nullability and will then 
>> (by default) require _every_ pointer parameter to have a nullability 
>> attribute.
> 
> Sorry, I should have said this file has been updated to use nullability, I am 
> just asking what the exact syntax is to stop it complaining about:
> 
> withError:(NSError**) theError ?
> 
> I’ve tried withError:(nullable NSError**) but it doesn’t work?
> 
> Cheers
> Dave
> 
>> On 15 Jun 2016, at 18:49, Jens Alfke <j...@mooseyard.com> wrote:
>> 
>>> I’m getting the Warning - "Pointer is missing a nullability type specifier 
>>> (_Nonnull, _Nullable, or _Null_unspecified)” 
>> 
>> You probably added a “nullable” or “__nullable” attribute somewhere else in 
>> that header. If you do that, the compiler enables nullability and will then 
>> (by default) require _every_ pointer parameter to have a nullability 
>> attribute.
>> 
>> If you want to add nullability annotations in declarations, you should 
>> bracket the header with NS_ASSUME_NONNULL_BEGIN and NS_ASSUME_NONNULL_END. 
>> These are macros that will enable nullability but tell the compiler to 
>> assume _Nonnull if no attribute is given. These macros are used in all the 
>> Cocoa headers.
>> 
>> —Jens
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list      (Xcode-users@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/xcode-users/dangerwillrobinsondanger%40gmail.com
> 
> This email sent to dangerwillrobinsondan...@gmail.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to