gpt4 book ai didi

ios - 无法识别的选择器发送到应用内购买产品的实例错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:48:32 28 4
gpt4 key购买 nike

我有一个 UITableView,用户可以从中选择自定义声音。我有 3 个用于 IAP 的非消耗品,我有基于用户从中选择的 index.section 内置的逻辑。 UIToolbarButton 的逻辑改变(有一个单独的 IBAction,用户可以在其中保存选择,但前提是他们“购买”了产品):

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

// Pull identifiers for IAP
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
bool alarmpackpurchased = [defaults boolForKey:@"Alarm_Pack"];
bool annoyancepackpurchased = [defaults boolForKey:@"Annoyance_Pack"];
bool serenepackpurchased = [defaults boolForKey:@"Serene_Pack"];

// Defualt index will always be allowed to save
if(indexPath.section == 0) {
savebuybutton.enabled = YES;
savebuybutton.title = @"Save";
savebuybutton.tintColor = [UIColor blueColor];
}
else {

if (indexPath.section == 1 && alarmpackpurchased == TRUE) {
savebuybutton.enabled = YES;
savebuybutton.title = @"Save";
savebuybutton.tintColor = [UIColor blueColor];
}
else if (indexPath.section == 2 && annoyancepackpurchased == TRUE) {
savebuybutton.enabled = YES;
savebuybutton.title = @"Save";
savebuybutton.tintColor = [UIColor blueColor];
}
else if (indexPath.section == 3 && serenepackpurchased == TRUE) {
savebuybutton.enabled = YES;
savebuybutton.title = @"Save";
savebuybutton.tintColor = [UIColor blueColor];
}

else {
savebuybutton.enabled = YES;
savebuybutton.title = @"Buy Pack";
savebuybutton.tintColor = [UIColor redColor];
}
}
}

下面是带有通知观察器的 viewWillAppear: 方法:

- (void)viewWillAppear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(productPurchased:) name:IAPHelperProductPurchasedNotification object:nil];
}

这是我在完成此产品的 IAP 后收到的错误:

2013-04-19 10:08:12.086 SleepLabBeta[43395:c07] -[AlarmSelectViewController productPurchased:]: unrecognized selector sent to instance 0x11444940
2013-04-19 10:08:12.125 SleepLabBeta[43395:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AlarmSelectViewController productPurchased:]: unrecognized selector sent to instance 0x11444940'
*** First throw call stack:
(0x1bf5012 0x1666e7e 0x1c804bd 0x1be4bbc 0x1be494e 0x11274f9 0x1c4f0c5 0x1ba9efa 0x105bbb2 0x1f57a 0x1f0b3 0x1eeae 0x924b1 0x1b978fd 0x92437 0x930fa 0x93d27 0x922a4 0x227653f 0x2288014 0x22787d5 0x1b9baf5 0x1b9af44 0x1b9ae1b 0x1a3e7e3 0x1a3e668 0x5aaffc 0x297d 0x28a5)
libc++abi.dylib: terminate called throwing an exception

最佳答案

我认为您没有在 AlarmSelectViewController 中实现 productPurchased 方法。

注意:您可以在某处实现。找出并改正。

关于ios - 无法识别的选择器发送到应用内购买产品的实例错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16106941/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com