Purchasing: the name StandardPurchasingModule does not exist in current context.

 The name StandardPurchasingModule.Instance does not exist in current context. The type or namespace IAppleExtensions could not be found
首先是报错内容,由于某种原因我需要打开一个别人压缩后的工程,在打开工程后出现了一些报错。具体的报错内容如下:

      error CS0246: The type or namespace name `IStoreListener' could not be found. Are you missing an assembly reference?

已知:对方给到的工程是成熟且完整的,在unity版本相同的情况下,排除环境照成的差异,那么真相只有一个:本地设置有问题。  


IStoreListener是什么呢,经过研究发现,此接口是unity自带的程序集UnityEngine.Purchasing下的。此程序集通过dll加载,但是在报错的工程中没有在对应的解决方案下发现UnityEngine.Purchasing的引用。

如图所示,该脚本所属的解决方案下并没有出现UnityEngine.Purchasing的引用。
此问题困扰我多时,重安装unity,尝试不破解unity,和删除Library和Temp重新生成解决方案等都没有效果后,我又把目标锁定在UnityEngine.Purchasing这个为何没有生效的问题。


解决过程:

通过Google后(//遇事不决问股沟)发现了有人遇到了同样的问题。为了避免误人子弟这里贴出原帖(https://forum.unity.com/threads/purchasing-the-name-standardpurchasingmodule-does-not-exist-in-current-context.457131/)此老哥解决了我的问题。
具体是在

下,打开IN-APP PURCHASING就可以了。然后Enable,此问题得到解决。


当然如果遇到此问题,根据原帖也可能是IAP出错,需要重新从官网下载IAP重新导入就可以了。
希望能够帮到下一个我。

猜你喜欢

转载自www.cnblogs.com/commissary/p/10239940.html