Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Resolved StandardPurchasingModule.appStore returns AppStore.GooglePlay on iOS

Discussion in 'Unity IAP' started by amjaliks, Dec 8, 2020.

Thread Status:
Not open for further replies.
  1. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    Maybe there is no big use for
    StandardPurchasingModule.appStore
    on platforms other than Android. But I still would expect this property return correct value on all platforms. Especially, because it was renamed to have platform agnostic name.

    I [tried to] use this property in
    switch
    statement. Of course, there are easy workarounds by checking platform at runtime or using preprocessor checks, but it makes code uglier.

    Package: 2.2.1
    Plugin: 2.2.4
     
    AntonPetrov likes this.
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I'll take a look.
     
  3. MatthieuSmith_Unity3D

    MatthieuSmith_Unity3D

    Joined:
    Oct 16, 2020
    Posts:
    23
    Indeed we are aware and fixed this in IAP 3.0.0 (which is in preview) but you should wait for the official release before releasing a product in production using 3.0.0

    3.0.0 is the top priority for the team right now. Although very unlikely that we will be releasing before the end of the year, I can saw that early 2021 we should be releasing the new version.

    For more information: https://forum.unity.com/threads/a-c...rges-the-unity-iap-plugin-3-0-0-soon.1009678/
     
    JeffDUnity3D and Baroni like this.
  4. MatthieuSmith_Unity3D

    MatthieuSmith_Unity3D

    Joined:
    Oct 16, 2020
    Posts:
    23
    Hello,

    Small change of plans, we will actually be releasing a IAP 2.2.5 soon, end of week or beginning of next week, which will contain this fix.
     
    amjaliks and Baroni like this.
  5. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    2.2.6 has this bug.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry for the delay, I will test and confirm.
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @amjaliks It's working for me on my iPhone 7 with IAP 2.2.6. Please share the code that you are using, and the iOS device you are testing on.

    MyDebug("Store = " + StandardPurchasingModule.Instance().appStore.ToString());

    Prints

    Store = AppleAppStore
     
  8. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    Code:
    Code (csharp):
    1. var module = StandardPurchasingModule.Instance();
    2.  
    3. string storeKey, storeName;
    4. switch (module.appStore) {
    5.    case AppStore.AppleAppStore:
    6.       storeKey = "appstore";
    7.       storeName = AppleAppStore.Name;
    8.       break;
    9.    case AppStore.GooglePlay:
    10.       storeKey = "googleplay";
    11.       storeName = GooglePlay.Name;
    12.       break;
    13.    case AppStore.AmazonAppStore:
    14.       storeKey = "amazon";
    15.       storeName = AmazonApps.Name;
    16.       break;
    17.    case AppStore.UDP:
    18.       storeKey = "udp";
    19.       storeName = UDP.Name;
    20.       break;
    21.    default:
    22.       Debug.LogError("Unsupported store: " + module.appStore);
    23.       _status = StoreStatus.Failed;
    24.       return;
    25. }
    26. Debug.Log("Store1: " + storeName);
    27. Debug.Log("Store2: " + module.appStore.ToString());
    Debug output:
    Code (csharp):
    1. Store1: GooglePlay
    2. Store2: GooglePlay
    iPhone 11 Pro, iOS 14.3
    Unity 2019.4.18f1
    Unity IAP 2.2.6, In App Purchasing 2.2.1
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Unfortunately I don't have an iPhone 11 to test on, I'm on 14.3 also. I'm using Unity 2020.1.6f1. Those are the only differences I see.
     
  10. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    What is MD5 for Stores.dll you test?
    Mine is de6502c0ff425d100606352d33096b6c.
     
  11. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Same here.
     
  12. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    A freshly initialized
    StandardPurchasingModule
    returns an incorrect
    appStore
    value. It gets fixed by
    ConfigurationBuilder
    .

    Code (csharp):
    1. var module = StandardPurchasingModule.Instance();
    2. Debug.Log("Store 1: " + module.appStore);
    3. ConfigurationBuilder.Instance(module);
    4. Debug.Log("Store 2: " + module.appStore);
    Debug output:
    Code (log):
    1. Store 1: GooglePlay
    2. Store 2: AppleAppStore
     
  13. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Ah glad you figured it out!
     
  14. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    Just to be clear. I still think it is incorrect behavior and needs to be fixed.
     
    AntonPetrov likes this.
  15. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Perhaps as a feature request, in the meantime just use the code you shared. Can you elaborate why this would cause issues in your code? This would help to drive priority.
     
  16. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    Of course, it isn't the highest priority. But it just need to be fixed. Why should
    StandardPurchasingModule.appStore
    return some (not so) random and unrelated value? Make it at least to return
    NotSpecified
    , if it is impossible to make it to return correct one from the beginning.

    I found this bug only because it created issues in my code.

    It isn't a big deal. There are a couple of simple workarounds for this. But it would save me some time, while a needed to figure out, why my code worked perfectly with Google Play and UDP builds, but started to fail in iOS build.
     
  17. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Why are you not able to use the syntax mentioned above that works? We likely won't make any changes with such an easy workaround, which also may be by design.
     
  18. GearedSun

    GearedSun

    Joined:
    Apr 17, 2014
    Posts:
    30
    Bad response. @amjaliks is correct about this being a bad behavior. The correct question is why Unity has not been able to fix this simple, yet annoying issue in such a long time... that is beyond me. And yes, this bug is still there.
     
  19. Arnaud_Gorain

    Arnaud_Gorain

    Unity Technologies

    Joined:
    Jun 28, 2022
    Posts:
    183
    The bug has been fixed a while ago and there is an easy workaround for previous versions, @GearedSun feel free to reach out if you have any issues with your project.

    This thread is now closed. Feel free to reach out via a new thread if you encounter further issues.
    Thanks!
     
Thread Status:
Not open for further replies.