Vungle Not Working On iPhone

local widget = require( "widget" ) -- Import for Vungle ads local ads = require "ads" -- Change this to your App ID. You will need -- separate App IDs for Android and iOS: --local appID = "Test\_Android" local appID = "56a2ea4c9e48f23d1c00000a" \_H = display.contentHeight \_W = display.contentWidth -- We recommend hiding the status bar so our -- full-screen videos are not obstructed display.setStatusBar( display.HiddenStatusBar ) display.setDefault( "background", 1 ) local vungleLogo = display.newImage( "images/vungleLogo.png" ) vungleLogo:translate( \_W / 3, 0 ) local vungleLogo = display.newImage( "images/corona.jpg" ) vungleLogo:translate( \_W / 1.5, 0 ) -- DEFAULT ADS: local function handleDefaultAdPlay( event ) if ( "ended" == event.phase ) then ads.show( "interstitial" ) end end local defaultAdButton = widget.newButton { defaultFile = "images/sfSky.jpg", onRelease = handleDefaultAdPlay, -- While ads are caching, our buttons are disabled -- and inform the user to please wait label = "Please wait..", labelColor = { default={ 255, 255, 255, 1.0 }, over={ 0, 0, 0, 0.5 } }, fontSize = 36, isEnabled = false, x = \_W / 2, y = \_H / 6 + 35 } -- INCENTIVIZED ADS: local function handleIncentivizedAdPlay( event ) if ( "ended" == event.phase ) then -- On click, we call ads.show() ads.show( "incentivized" ) end end local incentivizedAdButton = widget.newButton { defaultFile = "images/berlinSky.jpg", onRelease = handleIncentivizedAdPlay, label = "a video should", labelColor = { default={ 255, 255, 255, 1.0 }, over={ 0, 0, 0, 0.5 } }, fontSize = 36, isEnabled = false, x = \_W / 2, y = \_H / 2 + 40 } -- CUSTOM ADS: local function handleCustomAdPlay( event ) if ( "ended" == event.phase ) then ads.show( "incentivized", { isAnimated = true, isAutoRotation = false, orientations = UIInterfaceOrientationMaskLandscape, isBackButtonEnabled = true, isSoundEnabled = false, -- username is used for incentivized ads -- (so we know who to reward) username = "someUsername123" }) end end local customAdButton = widget.newButton { defaultFile = "images/londonSky.jpg", onRelease = handleCustomAdPlay, label = "be ready soon!", labelColor = { default={ 255, 255, 255, 1.0 }, over={ 0, 0, 0, 0.5 } }, fontSize = 36, isEnabled = false, x = \_W / 2, y = \_H / 1.2 + 45 } -- AD EVENT LISTENER -- Set this up before ads.init local function vungleAdListener( event ) if ( event.type == "adStart" and event.isError ) then -- Ad has not finished caching and will not play end if ( event.type == "adStart" and not event.isError ) then -- Ad will play defaultAdButton:setLabel ( "Please wait.." ) defaultAdButton:setEnabled ( false ) incentivizedAdButton:setLabel ( "a video should" ) incentivizedAdButton:setEnabled ( false ) customAdButton:setLabel ( "be ready soon!" ) customAdButton:setEnabled ( false ) end if ( event.type == "cachedAdAvailable" ) then -- Ad has finished caching and is ready to play defaultAdButton:setLabel( "Play Default Ad" ) defaultAdButton:setEnabled( true ) incentivizedAdButton:setLabel ( "Play Incentivized Ad" ) incentivizedAdButton:setEnabled ( true ) customAdButton:setLabel ( "Play Custom Ad" ) customAdButton:setEnabled ( true ) end if ( event.type == "adView" ) then -- An ad has completed end if ( event.type == "adEnd" ) then -- The ad experience has been closed- this -- is a good place to resume your app end end -- Do this as early as possible in your app -- An ad will begin caching on init and it can take -- up to 30 seconds before it is ready to play ads.init( "vungle", appID, vungleAdListener ) ads.show( "interstitial" ) -- Your app logic here :)

This is the code I am using that is straight from the Vungle sample project. All I did was input my app ID and put an ads.show() at the bottom.

 -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "portrait" }, iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay NSAppTransportSecurity = { NSAllowsArbitraryLoads = true }, } }, plugins = { -- Add this to use Vungle ["CoronaProvider.ads.vungle"] = { publisherId = "com.vungle", }, -- Add this if targeting Android and using -- Corona SDK version 2014.2264 or greater ["plugin.google.play.services"] = { publisherId = "com.coronalabs" }, }, --[[-- Android permissions androidPermissions = { "android.permission.INTERNET", },]]-- }

Here is my build.settings, all I did was add the 

NSAppTransportSecurity = { NSAllowsArbitraryLoads = true },

part, which I understand to be mandatory. However when I try to run on my physical iPhone 5C, nothing happens. It just stays at the “Please wait” screen and does not play an ad. What am I doing wrong?

@mpkostek, Have you resolved this?  Ive just updated some of my apps with vungle ads and apple has rejected them because the ads are not showing, I have just contaced Vungle about this.

Your code looks correct…

ads = require “ads”

ads.init(“vungle”, ‘xxxxxxxxxxx’)

later on…

ads.show()

This could be a Corona Build error, are you using build 2801 or something close to it?  I think it may be related to iOS sdk 9.2, because it has worked with iOS sdk 9.0.

I am using corona build 2802, iOS version 9.2, what should I do to fix this?

Their seems to be no solution …check this out…

https://forums.coronalabs.com/topic/59395-vungle-plugin-failed-during-ios-build/

There is a solution. Update your build.settings to support Apples new ATS (Application Transport Security). You cannot use http:// addresses with iOS 9 and later. They require you to use https:// now.  Vungle is using http:// addresses. There is code you can put in build.settings that tells Apple you still need to access http:// addresses.

See: https://coronalabs.com/blog/2015/09/17/about-app-transport-security-ats/

Rob

I got this working in my main app, I had the ATS permission in the wrong spot.

@mpkostek, Have you resolved this?  Ive just updated some of my apps with vungle ads and apple has rejected them because the ads are not showing, I have just contaced Vungle about this.

Your code looks correct…

ads = require “ads”

ads.init(“vungle”, ‘xxxxxxxxxxx’)

later on…

ads.show()

This could be a Corona Build error, are you using build 2801 or something close to it?  I think it may be related to iOS sdk 9.2, because it has worked with iOS sdk 9.0.

I am using corona build 2802, iOS version 9.2, what should I do to fix this?

Their seems to be no solution …check this out…

https://forums.coronalabs.com/topic/59395-vungle-plugin-failed-during-ios-build/

There is a solution. Update your build.settings to support Apples new ATS (Application Transport Security). You cannot use http:// addresses with iOS 9 and later. They require you to use https:// now.  Vungle is using http:// addresses. There is code you can put in build.settings that tells Apple you still need to access http:// addresses.

See: https://coronalabs.com/blog/2015/09/17/about-app-transport-security-ats/

Rob

I got this working in my main app, I had the ATS permission in the wrong spot.