Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is __AVAILABILITY_INTERNAL__IPHONE_2, NS_AVAILABLE ? Trying to use NSNumberFormatter, returns (null)
    primarykey
    data
    text
    <p>I've been having some trouble getting NSNumberFormatter to work properly.</p> <p>I'm compiling in iOS4 with the Three20 Framework.</p> <p>All of the NSNumberFormatter selectors require something called NS_AVAILABLE as a second parameter on the selector:</p> <pre><code>[numberFormatter setCurrencyGroupingSeparator:(NSString *)string __AVAILABILITY_INTERNAL__IPHONE_2:(int)_0]; </code></pre> <p>I'm not sure what I'm supposed to do with the second parameter. I've tried:</p> <pre><code>[numberFormatter setCurrencyGroupingSeparator:@"," __AVAILABILITY_INTERNAL__IPHONE_2:2]; // Warning: NSNumberFormatter' may not respond to '-setCurrencyGroupingSeparator:__AVAILABILITY_INTERNAL__IPHONE_2: [numberFormatter setCurrencyGroupingSeparator:@"," __AVAILABILITY_INTERNAL__IPHONE_2:2_0]; //Error: invalid suffix "_0" on integer constant </code></pre> <p>and several more iterations of that.</p> <p>If I don't specify the __AVAILABLE_INTERNAL__IPHONE_2 it doesn't throw a warning and compiles fine, but the selector text is black, not dark purple in Xcode as if it's not recognized. </p> <p>Here's the full code snippet: </p> <pre><code>NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease]; [numberFormatter setCurrencyGroupingSeparator:@","]; [numberFormatter setUsesGroupingSeparator:YES]; [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; numberString = [NSString stringWithFormat: @"$%@",[numberFormatter stringFromNumber:myNsNumber]]; // myNsNumber is an NSNumber with a value of 10000000 NSLog(@"numberString: %@",numberString); // numberString: (null) | instead of numberString: $10,000,000 </code></pre> <p>I've Googled <strong>_AVAILABILITY_INTERNAL__IPHONE_2</strong> and <strong>NS_AVAILABLE</strong> with no luck.</p> <p>Searching developer.apple.com only gives me the iOS 4.0 API Diffs.</p> <p>Is this an issue with Three20? Does anyone know whats going on here or what NS_AVAILABLE is all about?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload