iOS Question In-App Purchase test

Emme Developer

Well-Known Member
Licensed User
Hi!
I'm tryng in-app purchase and i followed the tutorials, but i really don't understand why i got this

B4X:
Purchase completed
Product: 0001, date=01:00:00, Transaction identifier=8A5845BF-8B38-414B-B300-EE477CE5FC72
Success = false
Maybe success = false because it is a test account? Or because i'm on simulator?
This is my code, i not already buy the product, and i'm using sandbox account. Any help?

B4X:
Main.MyStore.Initialize("MyStore")
            If Main.MyStore.CanMakePayments = True Then Main.MyStore.RequestPayment("0001")


Sub MyStore_PurchaseCompleted (Success As Boolean, Product As Purchase)
    Log("Purchase completed")
    If Product.IsInitialized Then
        Log("Product: " & Product.ProductIdentifier & ", date=" & DateTime.Time(Product.TransactionDate) & _
       ", Transaction identifier=" & Product.TransactionIdentifier)
    End If
    Log("Success = " & Success)
End Sub
 

Emme Developer

Well-Known Member
Licensed User
What is the output of Log("Error: " & Product.Error) ?
I tried on a real device with iOS 11 and it works. So i think we cannot reproduce in app purchase using simulator.
When i return on pc i am going to post Log
 

Emme Developer

Well-Known Member
Licensed User
@Erel error is
B4X:
<B4IExceptionWrapper: Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}>
I think because simulator doesn't have iTunes store, so in app purchase cannot be used on simulator
 

Computersmith64

Well-Known Member
Licensed User
You can't test IAPs on a simulator. I think you can test certain parts (like requesting products & showing localizes prices) but you can't complete a purchase from a simulator.

- Colin.
 
Top