Does NSNumber automatically cast strings?

cocoa-touch, ios, nsnumber, objective-c, storekit

Solution

Actually, thinking about it...

Initially I thought they must be converting the `NSString` into an `NSNumber` before doing whatever they need to do to get the information you are looking for.

However, on second thought...

I would guess that `StoreKit` is using the `value` against `SKStoreProductParameterITunesItemIdentifier` in a string. In which case they would do something like...

NSString *someStringToGetTheResults = [NSString stringWithFormat:@"thisIsThePath...?storeKitID=%@", dictionary[SKStoreProductParameterITunesItemIdentifier]];

This will be the same whether you pass in `@12345` or `@"12345"`.

Possibly...

No real way to tell though.

Problem

When creating an `SKStoreProductViewController`, I pass a dictionary with a parameter for the store identifier. : ``` @{ SKStoreProductParameterITunesItemIdentifier : @010101010 }; ``` This value is supposed to be an `NSNumber` (as it is above): The value associated with this key is an instance of NSNumber, representing the iTunes identifier for the item you want the store to display when the view controller is presented. But it works without complaint when I pass the value as a string: ``` @{ SKStoreProductParameterITunesItemIdentifier : @"010101010" }; ``` What's going on here? Is `NSNumber` automatically creating the correct number type from the string that it's given? Is this occurring in the `NSNumber` or is StoreKit doing this?

Original source