iOS Question in-app purchases - possible crashes?

sorex

Expert
Licensed User
Longtime User
Hello,

Is anyone here testing his in-app purchases on different OSs?

I finally found out that the apple store also has reviews :)

unfortunately 2 people complained that either the purchase of the ad remover didn't work
and/or the restore purchase crashes the app.

I tested this back then and yesterday on my IOS7 4s phone and it still works fine.

As that stupid review system doesn't allow replies or a way to contact the person
and Apple support doesn't want to give details either I don't have a clue which device or OS is giving problems.

I'm thinking about removing the feature before having the stamp of being a scammer if I can't figure this out.
 

sorex

Expert
Licensed User
Longtime User
sure, here you go...

B4X:
Private Sub Application_Start (Nav As NavigationController)
    no.RunMethod("setStatusBarHidden:animated:", Array(True, False))

    NavControl = Nav
    NavControl.NavigationBarVisible=False
    NavControl.ToolBarVisible=False

    Page1.Initialize("")
    Page1.Title = "bionoid"
    Page1.RootPanel.Color = Colors.White
    NavControl.ShowPage(Page1)

    App.IdleTimerDisabled = True

    remove_Ads=False
  
    game.Initialize(Page1)

    If File.Exists(File.DirDocuments,"e9cf6ec0f976f26fd8a55ef5663ab676678e25883d381f596374be46cb284fc3") Then
        remove_Ads=True
        game.remove_ads
    End If

    ad.Initialize("ad","ca-app-pub-whatever")  
    ad.RequestAd

    MyStore.Initialize("MyStore")
    If MyStore.CanMakePayments = False Then
     CanMakePayments=False
    Else
     CanMakePayments=True
    End If
  
End Sub

Sub manager_removeads
If CanMakePayments=True Then MyStore.RequestPayment("Binairo_remove_ads")  
End Sub

Sub manager_restorePurchases
MyStore.RestoreTransactions
End Sub

Sub MyStore_PurchaseCompleted (Success As Boolean, Product As Purchase)
   If Product.IsInitialized Then
       If Success And Product.ProductIdentifier="Binairo_remove_ads" Then Purchased_NoAds
   End If
End Sub

Sub Purchased_NoAds
  game.remove_ads
  remove_Ads=True
  File.WriteString(File.DirDocuments,"e9cf6ec0f976f26fd8a55ef5663ab676678e25883d381f596374be46cb284fc3","")
End Sub

Sub showInterstitial
  If remove_Ads=False And ad.IsReady Then
   ad.Show(Page1)
  End If
End Sub

Sub loadInterstitial
If ad.IsReady Then Return  
ad.RequestAd
End Sub
 
Last edited:
Upvote 0

sorex

Expert
Licensed User
Longtime User
that just hides the purchase & restore purchase buttons.

one person mentioned that the app crashes when clicking the restore purchase buttong.

the remove ads sub is called at the end of that process so it doesn't even reach that.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
right, missed that part. :)

but if they claim they bought it the restore should happen aswell, not?

I should actually hide both buttons when the store ain't ready for some reason.
this wasn't the case but the purshare was already ignore but the restore wasn't.
 
Last edited:
Upvote 0

sorex

Expert
Licensed User
Longtime User
no, only there.

I now call that game.removeads sub when the store init fails aswell so the buttons vanish on store failure or when adremover was purchased/restored.
 
Upvote 0
Top