I recently started using Xcode 7 and got what seems like a general warning:
Null passed to a callee that requires a non-null argument
I understand what is telling me, but I'm not sure if the solution is right for my specific problem. Here is the line where the warning occurs:
NSTextTab *tab = [[NSTextTab alloc] initWithTextAlignment:NSTextAlignmentLeft location:10.0f options:nil];
Now that Iβve looked at Matt Neubergβs example in his book iOS 8 Programming (published on GitHub), I see the following:
let s = "Onions\t$2.34\nPeppers\t$15.2\n" let mas = NSMutableAttributedString(string:s, attributes:[ // lines omitted... let terms = NSTextTab.columnTerminatorsForLocale(NSLocale.currentLocale()) let tab = NSTextTab(textAlignment:.Right, location:170, options:[NSTabColumnTerminatorsAttributeName:terms]) // lines omitted self.tv.attributedText = mas
From what I can tell, this is setting the text so that the decimal points in the lines match. Excellent. Useful Not what I need. I'm just trying to have a tab on the left side, giving a specific and consistent indent.
To βfixβ my code (that is, make the warning disappear), I changed my code to this:
NSTextTab *tab = [[NSTextTab alloc] initWithTextAlignment:NSTextAlignmentLeft location:10.0f options:[NSDictionary dictionary]];
It seems to work, but it looks like a super-kludgy work-around. Is my understanding of NSTextTab wrong? What is the right way to fix this?
source share