jamesmontemagno / InAppBillingPlugin

Cross-platform In App Billing Plugin for .NET
MIT License
651 stars 152 forks source link

SKPaymentTransactionObserver method #190

Closed desunit closed 5 years ago

desunit commented 5 years ago

Hi,

The App Store connect says: These in-app purchases can’t be promoted on the App Store because your latest app binary doesn’t include the SKPaymentTransactionObserver method.

Does InAppBillingPlugin support shouldAddStorePayment?

Thanks!

jamesmontemagno commented 5 years ago

We have one right here: https://github.com/jamesmontemagno/InAppBillingPlugin/blob/master/src/Plugin.InAppBilling.iOS/InAppBillingImplementation.cs#L413

Did you link out the assembly somehow?

Sebastian1989101 commented 5 years ago

@jamesmontemagno Thats not what he meant. I guess he refers to the option of buying IAP in the AppStore app which needs an observer within the app to handle the purchase properly. -> https://developer.apple.com/app-store/promoting-in-app-purchases/

And if this is the case, it would be relevant to this: https://github.com/jamesmontemagno/InAppBillingPlugin/issues/58

And if I don't miss something, I think that Xamarin.iOS still misses the correct implementaiton for StoreKit.SKPaymentTransactionObserver because it misses the paymentQueue function which is required for this.

jamesmontemagno commented 5 years ago

It should be available as we shipped iOS 11 bindings a long time ago. Let me know if it is missing...

I now understand the issue here. Interesting, would need to look this up and see what I can do.

Sebastian1989101 commented 5 years ago

@jamesmontemagno As far as my understanding goes for the Xamarin implementation of iOS, I would assume it is missing. Because I would expect a method that needs to be implemented with the name paymentQueue (or something that maps to this native method). Without the implementation of it, the IAP advertisement through the AppStore app is declined by Apple. But I'm not sure if this requires a public class to implement it because it needs to be handled at app launch as far as I know.

jamesmontemagno commented 5 years ago

How is this: https://github.com/jamesmontemagno/InAppBillingPlugin/pull/208

RobbiewOnline commented 5 years ago

Hi, could you please elaborate on what you're doing in AppStore iTunes connect that causes the error...

These in-app purchases can’t be promoted on the App Store because your latest app binary doesn’t include the SKPaymentTransactionObserver method.

As our app is submitted without seeing this error I'm assuming you're trying to do something extra in iTunes connect that we aren't doing, but I really want to understand what this could be.

Sebastian1989101 commented 5 years ago

@devology-rob It's pretty simple. You have to add an In-App-Purchase promotion in ITC. To create them, navigate to your app, then to Features and finally to App Store Promotions. There you have to create a promotion for one of your In-App-Purchases. As soon as you did that you will get this error message. See: https://youtu.be/TNd_0CQiUGo

RobbiewOnline commented 5 years ago

@devology-rob It's pretty simple. You have to add an In-App-Purchase promotion in ITC.

Hey thanks @Sebastian1989101 for the details and video showing the error. I've also now discovered this link if anyone else is interested. https://developer.apple.com/app-store/promoting-in-app-purchases/

desunit commented 5 years ago

How is this: #208

@jamesmontemagno Looks like exactly what was missing. :) Could you push it into NuGet? Thanks!

jamesmontemagno commented 5 years ago

Done :)

Sebastian1989101 commented 5 years ago

@jamesmontemagno Is there any example implementation to have for the new function (how to trigger the purchase correctly)? Because I can't find it in your documentation and, as you know, In-App-Purchase testing is pretty hard and espacially if this requires a call from the AppStore itself.

jamesmontemagno commented 5 years ago

See: https://github.com/jamesmontemagno/InAppBillingPlugin/pull/208/files#diff-2d38606a708100c6af296dad684945fd

Sebastian1989101 commented 5 years ago

@jamesmontemagno I saw the commit before but it is enough the return true in this method? Do I not need to handle the purchase in some way or is your library doin this already? Because on a native iOS Swift implementation I do the whole payment process in this method and also call the webserver for the verification and so on.

jamesmontemagno commented 5 years ago

I just bubble up the event from apple. I would recommend doing whatever they say. Maybe it is validating or something else. I really have no idea, just exposing the functionality.

ehsanmahmood commented 5 years ago

how we can implement SKPaymentTransactionObserver method in xamarin farms ?

I am facing this issue: "These in-app purchases can’t be promoted on the App Store because your latest approved binary doesn’t include the SKPaymentTransactionObserver method."

here is our Appdelegate.cs

using Foundation;
using UIKit;

namespace RelaxMeDude.iOS
{
    // The UIApplicationDelegate for the application. This class is responsible for launching the 
    // User Interface of the application, as well as listening (and optionally responding) to 
    // application events from iOS.
    [Register("AppDelegate")]
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
    {
        //
        // This method is invoked when the application has loaded and is ready to run. In this 
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            App.ScreenHeight = UIScreen.MainScreen.Bounds.Height;
            App.ScreenWidth = UIScreen.MainScreen.Bounds.Width;
            FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
            CarouselView.FormsPlugin.iOS.CarouselViewRenderer.Init();
            //  var foo = Firebase.Core.Configuration.SharedInstance;
           // Plugin.InAppBilling.InAppBillingImplementation.
                global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());
           // System.Diagnostics.Debug.WriteLine("\n\n-----------FROM FINISHED lANched-------------------\n\n");
            return base.FinishedLaunching(app, options);
        }

    }
}
JohnGaby commented 5 years ago

I have read through this thread and looked at the link above to the committed example which shows how to implement this. However when I try and add the line

Plugin.InAppBilling.InAppBillingImplementation.OnShouldAddStorePayment = OnShouldAddStorePayment;

to my AppDelegate.cs, I get the error:

'InAppBillingImplementation' does not contain a definition for 'OnShouldAddStorePayment'

I have version 2.0.0 installed (which seems to be the latest). How can I get this fix?

Thanks.

DevEddy commented 4 years ago

Same here, @JohnGaby did you find a solution?

Edit: Okay I see, just update to beta channel.

Thanks, Eddy

JohnGaby commented 4 years ago

No I did not.

blmiles commented 4 years ago

Done :)

@jamesmontemagno I know this is a bit old but it isn't actually DONE :-(

I've just installed the latest plugin off Nuget and also the sample code from GitHub. The version in Nuget is 2.0.0 and does not contain a definition for 'OnShouldAddStorePayment' . However, the latest sample code does. It would be great if the latest bulld was put onto Nuget that would include the missing code. Msg displayed in VS: 'InAppBillingImplementation' does not contain a definition for 'OnShouldAddStorePayment'

I have actually included the version 3.0.0.0 Beta and it's all there. Not got it working just yet.

Thanks