I tried to upgrade UNITY from 2019.1.8f1 to 2019.2.13f1, and started to get a lot of compiler errors about IAP
also upgraded IAP to the latest version
-Can’t implement interface member ‘IStoreListener’
using UnityEngine.Purchasing.Security -The name security does not exist in the namespace
I downgraded back to 2019.1.8f1 but having the same error
I’m currently stuck with my project. Everything was perfect until that update :\
For the time being, you’ll likely want to use a project backup before the upgrade. Keep in mind that IAP requires both the In App Purchasing package in Package Manager, and the IAP asset store package. Make sure you have both installed.
So the backup solution would be the path forward. There should be no need to upgrade the package in Package Manager, or removing plugin folders. What file is the error in? I might suggest to try with a brand new/empty project and import IAP to compare, for testing.
OK now I’m using my backup (entire Unity project folder backup which I stored before all upgrades), using Unity 2019.1.8f1, Now I’m getting different errors with UnityPurcheshing scripts, what a nightmare, this is why I’m afraid to update Unity,
so now it’s the same old backup, but maybe something is different with Unity 2019.1.8f1 app when I updated the IAP?
Errors:
Assets\Plugins\UnityChannel\XiaomiSupport\AppStoreSettings.cs(7,19): error CS0234: The type or namespace name ‘Store’ does not exist in the namespace ‘UnityEngine’ (are you missing an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(20,19): error CS0234: The type or namespace name ‘Store’ does not exist in the namespace ‘UnityEngine’ (are you missing an assembly reference?)
Assets\Plugins\UnityChannel\XiaomiSupport\AppStoreSettings.cs(28,16): error CS0246: The type or namespace name ‘AppInfo’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\CodelessIAPStoreListener.cs(21,19): error CS0246: The type or namespace name ‘ProductCatalog’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPConfigurationHelper.cs(12,91): error CS0246: The type or namespace name ‘ProductCatalog’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(36,13): error CS0246: The type or namespace name ‘IAppleExtensions’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(37,13): error CS0246: The type or namespace name ‘IMoolahExtension’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(38,13): error CS0246: The type or namespace name ‘ISamsungAppsExtensions’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(39,13): error CS0246: The type or namespace name ‘IMicrosoftExtensions’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(40,13): error CS0246: The type or namespace name ‘IUnityChannelExtensions’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(41,13): error CS0246: The type or namespace name ‘ITransactionHistoryExtensions’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(42,13): error CS0246: The type or namespace name ‘IGooglePlayStoreExtensions’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(630,38): error CS0246: The type or namespace name ‘ILoginListener’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(647,29): error CS0246: The type or namespace name ‘UserInfo’ could not be found (are you missing a using directive or an assembly reference?)
Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(634,25): error CS0246: The type or namespace name ‘UserInfo’ could not be found (are you missing a using directive or an assembly reference?)
But it doesn’t work with the old version as well, I saved the entire UNITY project folder as a backup before the upgrade, and now when opening it (in the same location) I’m getting all those namespace errors, why? I’m using the same project, same unity version and the same folder that already worked before, what else is different? Does Unity change other files in the system that I need to restore? Some personal settings? Packages? I technically can restore those too if you tell me what other changes happened to my system since I installed the new IAP versions and new unity version
Another thing -I noticed that after deleting UnityPurchasing and UnityChannel folders and installing IAP from services and asset store, I don’t see that UnityChannel folder is being created.
Update: I’m using now a very old version of the project, and returned to the first problem of this thread- errors on MyIAPManager script, can’t implement istorelistener, I can’t fix this problem
Same problem here. Everything was working fine until I upgraded IAP to 4.6.0 through the Update Button in Services window.
Now I have this error: ‘MyIAPInit’ does not implement interface member ‘IStoreListener.OnInitializeFailed(InitializationFailureReason, string?)’
The error you’re seeing is because a new method was added to the IStoreListener interface in 4.6.0. A variant of OnInitializedFailed() that takes two args: an InitializationFailureReason as 1st arg, and a string as 2nd arg.
In your code, if you do highlight IStoreListener, right-click and do “Go To Definition” (assuming Visual Studio), you will see the definition of the IStoreListener interface. Which looks like this as of 4.6.0
In your class that inherits from IStoreListener you need to have a method defined for both variants of OnInitializedFailed() in order to make the error you listed go away. The variant with just one arg is marked as Obsolete but you still need to have a definition for it in your class to fully implement this interface. Until the old method is removed you need have both.
I also went through the same thing with version 4.6.
The solution was to add this
public class MyStoreListener : MonoBehaviour, IStoreListener
{
// …
public void OnInitializeFailed(InitializationFailureReason error)
{
// Implementation for old version
}
public void OnInitializeFailed(InitializationFailureReason error, string message)
{
// Implementation for new version
}
I tried the following example from a new project and the exact same thing happens: Assets\Samples\In App Purchasing\4.7.0\01 Buying Consumables\BuyingConsumables.cs
Assets\Samples\In App Purchasing\4.7.0\01 Buying Consumables\BuyingConsumables.cs(9,53): error CS0535: ‘BuyingConsumables’ does not implement interface member ‘IStoreListener.OnInitializeFailed(InitializationFailureReason)’
Had the same issue.
Just copy the IStoreListener.OnInitializeFailed(InitializationFailureReason) duplicate the block and add (InitializationFailureReason, string message).
Your problem will be solved.