私は通知に非常に精通していますが、アプリ内購入を使用した後、理由もなくクラッシュします (とにかくそれが関係しているとは思えません)。
したがって、ユーザーが購入を完了すると、この関数が呼び出されます:
- (void)provideContentForProductIdentifier:(NSString *)productIdentifier
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:productIdentifier];
[[NSUserDefaults standardUserDefaults] synchronize];
[[NSNotificationCenter defaultCenter] postNotificationName:IAPHelperProductPurchasedNotification object:productIdentifier userInfo:nil];
// i get the crash here when trying to post the notification.
}
これで、オブザーバーを含むメイン シーンが次のように開始に設定されました。
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(productPurchased:) name:IAPHelperProductPurchasedNotification object:nil];
オブザーバーでオブジェクトがnilに設定されているためですか?それは何ですか?