How do you convert an NSUInteger
into an NSString
? I've tried but my NSString
returned 0 all the time.
NSUInteger NamesCategoriesNSArrayCount = [self.NamesCategoriesNSArray count];
NSLog(@"--- %d", NamesCategoriesNSArrayCount);
[NamesCategoriesNSArrayCountString setText:[NSString stringWithFormat:@"%d", NamesCategoriesNSArrayCount]];
NSLog(@"=== %d", NamesCategoriesNSArrayCountString);
When compiling with support for
arm64
, this won't generate a warning:You can also use:
where row is a NSUInteger.
I hope your
NamesCategoriesNSArrayCountString
isNSString
; if yes use the below line of code.istead of
This String Format Specifiers article from Apple is specific when you need to format Apple types:
[NSString stringWithFormat:@"%ld", (long)value]
: NSInteger displayed as decimal[NSString stringWithFormat:@"%lx", (long)value]
: NSInteger displayed as hex[NSString stringWithFormat:@"%lu", (unsigned long)value]
: NSUInteger displayed as decimal[NSString stringWithFormat:@"%lx", (unsigned long)value]
: NSUInteger displayed as hex[NSString stringWithFormat:@"%f", value]
: CGFloat[NSString stringWithFormat:@"%ld", (long)value]
: CFIndex displayed as decimal[NSString stringWithFormat:@"%lx", (long)value]
: CFIndex displayed as hexSee the article for more details.
When compiling for
arm64
, use the following to avoid warnings:Or, in your case:
(Also, tip: Variables start with lowercase. Info: here)