I have the following method:
- (id) insertDictationResultPlaceholder
{
return nil;
}
The Xcode analyzer is barking at me and telling me:
nil returned from a method that is expected to return a non-null value
So, for a method with a return parameter of id
, how do I return nothing? Would an empty string be good? What's the nicest solution here?
You can use [NSNull null]
instead. Just be cautious when you're checking for it, because it does NOT equate to nil
if you try to do a comparison:
if ([NSNull null] == nil)
{
// This code will never run
}