Search Unity

Unity Ads works in Unite, Android, but not iOS

Discussion in 'Unity Ads' started by CaptGhostRyder, Jan 16, 2019.

  1. CaptGhostRyder

    CaptGhostRyder

    Joined:
    Jan 16, 2019
    Posts:
    7
    Hey all, so I have been having issues with Unity ads only on the iOS version when converting to Xcode. Basically everything works fine in Android, Unity shows the ads are working when testing in it, but the moment I output the Xcode version and run it on my iPhone it no longer works. It works on my old version of the game (Which was running on 2018.3.0 f2 with Unity Ads 3.1 and still works on the store and when outputting it to my phone. The new version has a few changes to the game and some improvements but nothing should have been effected in ads. I checked the coding and I have the code Unity shows for the iOS version of the ads. The code for the ads is exactly the same. Any ideas?

    Here is the code snippet from the game for the ads.

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.Advertisements;
    //using GooglePlayGames; //Google play store
    //using GooglePlayGames.BasicApi; //More Google Play

    public class DeathManager : MonoBehaviour {

    public static DeathManager dm;

    public int deathCount = 1;
    public int achieveCount = 0;
    private int randNumber;
    public static string gameId = "xxxxxx6";


    // Use this for initialization
    void Start () {
    randNumber = Random.Range(7, 12);
    if (dm == null)
    dm = this.GetComponent<DeathManager>();

    DontDestroyOnLoad(this);
    if (FindObjectsOfType(GetType()).Length > 1)
    {
    Destroy(gameObject);
    }
    if (Advertisement.isSupported)
    {

    Advertisement.Initialize(gameId, true);
    }

    }

    //Make a function to check to see if we need to play the Ads
    public void CheckDeaths()
    {
    //incrememnt for achievemetn
    achieveCount++;
    if (achieveCount >= 20)
    {
    Social.ReportProgress("why1", 100, success => { }); // Die 10 times
    }
    if (achieveCount >= 200)
    {
    Social.ReportProgress("die2", 100, success => { }); // Die 100 times

    }

    if (deathCount >= randNumber)
    {
    Advertisement.Show();
    deathCount = 1;
    randNumber = Random.Range(7, 12);

    }
    else
    {
    deathCount++;
    }
    }
    }
     
  2. mikaisomaa

    mikaisomaa

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    358
    Are you changing the game ID from the Android one when building for iOS? The game IDs must be unique to the platform.
     
  3. CaptGhostRyder

    CaptGhostRyder

    Joined:
    Jan 16, 2019
    Posts:
    7
    Yes, the one for iOS according to Unity is one that ends in a 6 while the android ends in 5. I made sure I have changed it. But I did try with both codes just to make sure.
     
  4. CaptGhostRyder

    CaptGhostRyder

    Joined:
    Jan 16, 2019
    Posts:
    7
    Still having issues, any other suggestions? I have checked my codes and everything seems fine.
     
  5. Callie-Zhu

    Callie-Zhu

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    42
  6. CaptGhostRyder

    CaptGhostRyder

    Joined:
    Jan 16, 2019
    Posts:
    7
    I will look through the logs, but did not see an error. I will look again and post a copy here. Its weird because it works in both Android and Unity but not the iOS version. Like I said it worked before and the only major changes we made between them is adding a pause at the beginning of each level with words on display. Not sure why that would cause a problem as the code for the ads has not changed at all.
     
  7. free4allgames

    free4allgames

    Joined:
    Dec 5, 2018
    Posts:
    39
    The ads worked for me on iOS only after downgrading the version used by the package manager to 2.0.9.
     
  8. CaptGhostRyder

    CaptGhostRyder

    Joined:
    Jan 16, 2019
    Posts:
    7
    Resolved the issue of the ads not showing up, seemed to start working after reentering everything and restarting it. Not sure what changed but it works now.