JackAppDev / flutter_iap

Flutter iap plugin
MIT License
100 stars 15 forks source link

[iOS] FlutterIap.buy() always returns 'emptyProducts', doesn't prompt user for purchase. #24

Closed ItsCalebJones closed 6 years ago

ItsCalebJones commented 6 years ago

Maybe I am missing something with iOS - i'm fairly new to the platform... anyways I have a In-App-Product configured with the ID '2018_founder'.

If I call FlutterIap.fetchProducts(["2018_founder"]) it properly grabs all the details of the product, however if I call FlutterIap.buy('2018_founder') nothing happens for the user and if i'm on the simulator I can see the method is returning a 'emptyProducts' response. This occurs both in debug and release builds from what I can tell.

All relevant code is here: https://github.com/ItsCalebJones/spacelaunchnow_flutter/blob/master/lib/views/settings/settings_page.dart

JackAppDev commented 6 years ago

Is this on ios, Android, or both? Also, neither platform allows testing in app purchases in the simulator.

ItsCalebJones commented 6 years ago

I am only using Flutter on iOS for now - this occurs both with real devices deployed to the App Store and in the simulator (apparently seeing that StoreKit might be testable now).

ItsCalebJones commented 6 years ago

From searching through the repo - here is the only place 'emptyProducts' is returned - I don't know enough about StoreKit or Swift to understand why iapProducts.count is equal to 0 there. And as far as I can tell I am doing essentially the same thing as the example.

ItsCalebJones commented 6 years ago

@JackAppDev do you need any additional details? Willing to help however you need.

miyoyo commented 6 years ago

I've been lookin in there to make it work, it seems like it's looking for iapProducts Yet it's only referenced three times, none of it being as an assignation, therefore it's always empty. fileprivate var iapProducts = [String : SKProduct]() if iapProducts.count == 0 { let product = iapProducts[id]!