Remove Ads (in App Purchase) Ios

Discussion in 'Buildbox 3.0' started by landofgreendev, Feb 28, 2020.

  1. landofgreendev

    landofgreendev Boxer

    Joined:
    Nov 9, 2018
    Messages:
    74
    Likes Received:
    14
    Hey everyone! I have got a ‘remove ads’ button in my game, to do just that, remove the ads in the game...

    The button works fine and the transaction goes through (you type in your Apple ID and pay for the In app purchase) - the only issue is that it doesn’t actually remove the adverts in the game lol! It says the purchase has been successful and I don't get any errors. It just doesn't seem to remove any ads.

    I am using the interstitial node and the rewarded video node. Is there some script that I need to put within each node for the ads to STOP popping up after purchasing to remove the ads?

    Is there something else I have to add to make this work? I can't see any other settings within Buildbox. I am testing via TestFlight, and i'm using Admob.

    Any help is much appreciated!

    Cheers!
     
  2. Ivan Perfetti

    Ivan Perfetti Boxer

    Joined:
    Sep 9, 2018
    Messages:
    68
    Likes Received:
    73
    @Sean Buildbox
    UP! I'm having the same issue, IAP purchase successful but ads still there; I'm using interstitials, rewarded videos and Admob as well.
     
  3. Ivan Perfetti

    Ivan Perfetti Boxer

    Joined:
    Sep 9, 2018
    Messages:
    68
    Likes Received:
    73
    @landofgreendev @Sean Buildbox
    Ok, actually I might have just found a workaround; in the UI where I have the purchase button for the IAP which removes ads I've added an object with a little script to check if the button is visible and indeed it works in detecting that the button is hidden after the IAP has been successfully purchases so this could be used to stop ads from running, at least the ones called from nodes.

    This is the line I've added in the update function:
    let btn = this.ui().find('Purchase Button')[0].isVisible();

    Hopefully there is a better way but in the meanwhile this might work, by the way I still have to test it on a device in the preview, I'll test it on an iPhone tomorrow and let you know.
     
  4. Ivan Perfetti

    Ivan Perfetti Boxer

    Joined:
    Sep 9, 2018
    Messages:
    68
    Likes Received:
    73
    @landofgreendev @Sean Buildbox
    Hi there, I've just tested this solution on an iPhone and it worked fine to stop ads from showing after the Remove Ads In App Purchase has been completed; setup is very simple, this object only has a start node connected to a script node.
    simple-script.png
    Inside the script I'm checking a few times per second if the Purchase Button is visible and assigning the negated resulting value, true or false, to a global setting so that I can use this inside the interstitial ad node for example to stop ads from running.
    Here's the script I'm using at the moment in the UI where the IAP is present.

    var enabled = false;
    var counter = 0;
    var maxCounter = 10;
    var btn;

    function update(dt){

    if (enabled){
    counter += 1;
    if (counter > maxCounter) counter = 1;
    if (counter == 1){

    Settings.disableAdsIapPurchased = !btn[0].isVisible();
    }
    }
    }

    function signal(name, value){

    enabled = value;
    btn = this.ui().find('Purchase Button');
    }

    For sure there are better or more elegant solutions, please let me know if you know one.
    This is what I've found as of now and it just works, hope this can be of help to you.
    As a side note, in case anybody is wondering, I'd like to add that a global setting is required so that you can use it everywhere you like inside your game and also save the status of the purchase button for next app launches.
    You should also initialize this setting the first time you launch the app to avoid the risk of using it when it doesn't exist yet.
    In case you need it you can do that with something like this:
    if (Settings.youNameIt === undefined) Settings.youNameIt = false;
     
    Sean Buildbox likes this.
  5. Sean Buildbox

    Sean Buildbox Administrator Staff Member

    Joined:
    Sep 24, 2015
    Messages:
    563
    Likes Received:
    655
    We're actually in the process of merging fixes into our next update similar to what you've done here. Awesome work ;)
     
    volcank likes this.
  6. shahar.m192

    shahar.m192 Avid Boxer

    Joined:
    Oct 7, 2018
    Messages:
    198
    Likes Received:
    39
    So the remove ads button doesn't work for now?
     
  7. Karim MS

    Karim MS Boxer

    Joined:
    Mar 20, 2020
    Messages:
    5
    Likes Received:
    5
    What I do is simply by checking if remove ads IAP has been purchased directly in the Interstitial node :

    ShowAd = Ads.isRemoveAdsPurchased();

    f(value && ShowAd == false){
    Ads.showInterstitial();
    this.emitSignal('Done', true);
    } else if (ShowAd == true) {
    this.emitSignal('Done', true);
    }

    My problem is the IAP is not working, I have this error on xcode logs : transaction error: Error Domain=SKErrorDomain Code=0
    "Cannot connect to iTunes Store"

    I don't understand what is the issue. I use the right identifier not the Apple ID, I have a sandbox user, I logout from iCloud / App Store and restarted my iPhone etc... I tested everything but still having this error.

    My in-app status on App Store connect is : "ready to submit" I don't know if t's because of that ?

    Can you help me on this ?
     
    Ivan Perfetti likes this.
  8. Karim MS

    Karim MS Boxer

    Joined:
    Mar 20, 2020
    Messages:
    5
    Likes Received:
    5
    My problem is the IAP is not working, I have this error on xcode logs : transaction error: Error Domain=SKErrorDomain Code=0
    "Cannot connect to iTunes Store"

    I don't understand what is the issue. I use the right identifier not the Apple ID, I have a sandbox user, I logout from iCloud / App Store and restarted my iPhone etc... I tested everything but still having this error.

    My in-app status on App Store connect is : "ready to submit" I don't know if t's because of that ?


    Hello Ivan, any idea of what I am doing wrong ?
     
  9. Ivan Perfetti

    Ivan Perfetti Boxer

    Joined:
    Sep 9, 2018
    Messages:
    68
    Likes Received:
    73
    @Karim MS Hey, thanks! This is way better, I completeley missed isRemoveAdsPurchased() function! :eek:
    About your issue I don't know, I used to have this problem but solved it just by using a sandox account and the right ID.
    Also, I've read in another thread that for Admob, if that's your case, you should fill in all of the fields in Buildbox settings > SDKs, you are supposed to enter all of the 5 IDs even if you are not using them; not quite sure about that since I had already filled in them all. And of course you need to sign all of the Apple contracts in App Store Connect.
    "Ready to submit" is right, my IAP has the same status.
    Hope this helps.
     
  10. Karim MS

    Karim MS Boxer

    Joined:
    Mar 20, 2020
    Messages:
    5
    Likes Received:
    5
    Thanks ! Unfortunately I was not able to make it works. I decided to submit the game without the IAP for now and I will try to fix on the next update.
     

Share This Page