Note that there are some explanatory texts on larger screens.

plurals
  1. POUser default change notification with an in-app purchase
    primarykey
    data
    text
    <p>I am implementing in-app purchased for my app. As such, I am using the product identifier format of com.companyname.product.feature. The product identifier is used for the in-app purchase (which is working fine in sandbox) and as a user default to know that the product has been purchased. When the user purchases a product, the com.companyname.product.feature user default is set to true. All is working except for the following.</p> <p>One of my view controller's is listening for the user default change so that it can modify its behavior based on the product purchase. However the controller is never notified of the user default change. I have implemented this type of observation many times in the past, but this is not working. Can it have something to do with the "." in the key path (that I have never before done)?</p> <p>In my app delegate:</p> <pre><code>NSString *const PHKeyIAPFeature = @"com.companyname.appname.feature"; // also the product ID for the features </code></pre> <p>In my observer:</p> <pre><code> [[NSUserDefaults standardUserDefaults] addObserver:self forKeyPath:PHKeyIAPFeature options:NSKeyValueObservingOptionNew context:NULL]; </code></pre> <p>In my IAP manager:</p> <pre><code> [[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:productIdentifier]; </code></pre> <p>where productIdentifier = PHKeyIAPFeature.</p> <p>I know that the user default is being updated when the product is purchased, as a restart of the app reflects the updated user default.</p> <p>Any ideas? TIA for the help.</p> <p>--John</p>
    singulars
    1. This table or related slice is empty.
    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