参照官网文档集成PLUGINX IOS IAP
http://www.cocos2d-x.org/docs/manual/framework/html5/jsb/plugin-x/ios-iap/zh
更改产品id
var pidList = "1071764597"];
this.PluginIAP.callFuncWithParam("requestProducts", plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, pidList.toString()));
但在使用产品id,获取列表时返回的 productInfo 里没有东西
下面代码已跑到 cc.log(“onRequestProductResult productInfo:” , productInfo);
onRequestProductResult: function (ret, productInfo) {
var msgStr = "";
if (ret == plugin.ProtocolIAP.RequestProductCode.RequestFail) {
msgStr = "request error";
this.toggleToast(false);
} else if (ret == plugin.ProtocolIAP.RequestProductCode.RequestSuccess) {
cc.log("onRequestProductResult productInfo:" , productInfo);
this.product = productInfo;
msgStr = "list: ";
for (var i = 0; i < productInfo.length; i++) {
var product = productInfo*;
msgStr += product.productName + " ";
}
msgStr += " ]";
this.toggleToast(false);
}
var label = this.getChildByTag(TAG_GETPRODUCTLIST_RESULT);
if (label) {
label.setString(msgStr);
}
}
*
打印如下:
*--- Begin quote from ____*
JS: Finished loading....................
2016-01-09 22:41:19.554 mobileGameMac iOS param is {(
1071778921
)}
JS: onRequestProductResult productInfo: 474043283.799306
*--- End quote*
productInfo是一个随机小数(可能是c++中的无效指针地址) 真机和模拟器上返回的数字不一样
itunesconnect 产品设置好了的:
<img title = '5135E0E3-5C2A-41DE-BF37-A4B8C6E11C89.png' src='http://cdn.cocimg.com/bbs/attachment/Fid_59/59_389325_50af4c4f75a89e4.png' >
bundle id 这些自然也设置完成了的。
救大神救命啊!!!!!:3::3::3:
都休息了啊?