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

来源:互联网 发布:电路考研参考书知乎 编辑:程序博客网 时间:2024/06/05 07:20

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


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


在AppDelegate的application:didFinishLaunchingWithOptions:方法中

[cpp] view plaincopy
  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 plaincopy
  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插件,重启设备即可解决;

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



转自:http://blog.csdn.net/duxinfeng2010/article/details/10043641 



0 0
原创粉丝点击