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.
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)?
In my app delegate:
NSString *const PHKeyIAPFeature = @"com.companyname.appname.feature"; // also the product ID for the features
In my observer:
[[NSUserDefaults standardUserDefaults] addObserver:self forKeyPath:PHKeyIAPFeature options:NSKeyValueObservingOptionNew context:NULL];
In my IAP manager:
[[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:productIdentifier];
where productIdentifier = PHKeyIAPFeature.
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.
Any ideas? TIA for the help.
--John