我对通知非常熟悉,但是在使用应用内购买后,我毫无理由地崩溃了(我怀疑它是否与它有关)。
所以当用户完成购买时,这个函数被调用:
- (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 吗?应该是什么?