使用Parse内付费服务出现的Error Domain=Parse Code=146 "The operation couldn’t be completed. (Parse error 146.)

本文介绍如何利用Parse组件简化iOS应用内的付费功能实现,特别关注在真机测试时遇到的错误ErrorDomain=ParseCode=146的解决方法,包括产品ID验证、设备状态检查等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

因为开发一个应用有个内付费去广告功能,介于苹果官方提供的方法没用过,感觉有些复杂,于是选用了第三方组件Parse来解决这个问题,简单易操作;


Parse简化苹果官方内付费问题,使用方法分厂简单只有两个Block方法,以下实现简单的购买过程


在AppDelegate的application:didFinishLaunchingWithOptions:方法中

[cpp]  view plain copy
  1. // Use the product identifier from iTunes to register a handler.  
  2. [PFPurchase addObserverForProduct:@"ProductID" block:^(SKPaymentTransaction *transaction) {  
  3.     // Write business logic that should run once this product is purchased.  
  4.       
  5. }];  



在购买的地方调用
[cpp]  view plain copy
  1. [PFPurchase buyProduct:@"ProductID" block:^(NSError *error) {  
  2.     if (!error) {  
  3.         // Run UI logic that informs user the product has been purchased, such as displaying an alert view.  
  4.     }  
  5. }];  


但是我在真机测试的时候一直出现Error Domain=Parse Code=146 "The operation couldn’t be completed. (Parse error 146.),即使新建工程也同样此错误。

Parse官方网站提供了对这个错误答疑,由于不够细心把解决方案多次忽略:①可能是这个产品ID(ProductID)有问题,或者不存在。②而我存在的问题是设备越狱了导致不能购买。

解决办法:①检查在itunes上ID问题;

②在Cydia中卸载掉Assync插件,重启设备即可解决;

③以上不行,换未越狱的设备试吧。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值