Revmob on ios not working (Invalid Parameter: URL argument was malformed URL)

I finally got the Revmob plugin to show rewarded videos on Android (see here), but I discovered that it is not working on ios. First thing I noticed is that on ios the sessionStarted event phase is dispatched (on android it is not) but I keep on getting the following error when trying to load an rewarded video:

[RevMob] Starting RevMobAds event phase: init event phase: sessionStarted --Now I try to load a rewardedVideo Invalid Parameter: URL argument was malformed URL [RevMob] Initializing Fullscreen. [RevMob] Fail with error: unsupported URL event phase: failed event type: rewardedVideo event isError: true event response: unsupported URL - Error Code -1002 Invalid Parameter: URL argument was malformed URL

Anybody has some ideia what could be wrong?

ps. I have the following in the plist section of the build.settings:

 NSAppTransportSecurity = { NSAllowsArbitraryLoads=true },

Thanks in advance,

Felix

Was there more to the device’s console log?

Hello Rob,

thanks for you attention.

No there is nothing more than this.

Any idea where to get more information? Is there a debug flag for revmob?

Best,

Felix

Now I tried to load an interstitial Ad and got the following logs:

[RevMob] Starting RevMobAds ad phase: init ad phase: sessionStarted -- trying to load interstitial here, code: revmob.load( "interstitial", "Fullscreen" ) [RevMob] Initializing Fullscreen. [RevMob] Server response with (401) status code. ad phase: failed event type: interstitial event isError: true event response: The operation couldn’t be completed. (Server response with (401) status code. error -1.) - Error Code -1

My guess is that in case of the rewarded video the space in “Rewarded Video” is causing the malformed Url, but I hardly believe that I am the only one using rewarded videos on revmob or that I am the first to experience this problem. Anyway, I have no clue what this new error means :confused:

Other thing. On Android I have no [RevMob] logs at all. (Like [RevMob] Initializing Fullscreen)

Felix

Hey Felix.

The Revmob plugin is in use by a bunch of developers and is known to work on supported devices.

Due to this, can you provide me a sample of how you are using it?

Generally these problems are down to incorrect parameters or ids.

Thank you

Hei Danny, thanks for looking into this.

This is my code that works on Android, but not on iOS

local function adListener( event ) print("ad phase: " .. event.phase) if ( event.phase == "init" ) then -- Successful initialization if event.isError then print( "isError: " .. event.isError ) elseif globals.platform == "Android" or globals.platform == "Win" then print("loading ad ...") revmob.load( "rewardedVideo", placementID ) end elseif ( event.phase == "sessionStarted" ) then -- Successful initialization -- This only happens on iOS print("event phase: sessionStarted") --revmob.load( "banner", "Banner" ) --Banner revmob.load( "rewardedVideo", placementID ) elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded print( event.type ) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) --this is done when the player clicks the continue button --timer.performWithDelay(30000, function() revmob.load( "rewardedVideo", placementID ) end) elseif (event.phase == "rewardedVideoCompleted") then print("rewarded video watched...") revmob.load( "rewardedVideo", placementID ) countingDown = true local numPoints = 3 local function addPoints() numPoints = numPoints-1 if numPoints \>= 0 and points \< curWorldPoints then makeRing("in") timer.performWithDelay(500, function() points = points + 1 collisionAnimation(50) if mode == "survivalMode" then pointsText.text = points else pointsText.text = curWorldPoints-points end checkLevel() addPoints() end) else timer.performWithDelay(500, function() countingDown = false if points \< curWorldPoints then startFct() end end) end end gameOverGroup:toBack() timer.performWithDelay(500, function() addPoints() end) end end -- Initialize RevMob if globals.platform == "Android" or globals.platform == "Win" then revmob.init( adListener, { appId="576f1744ba2d1fde3bf9924e" } ) --576f1744ba2d1fde3bf9924e continue video android else revmob.init( adListener, { appId="5770527b36dd49430b4b5242" } ) --5770527b36dd49430b4b5242 continue video ios end

Here again the log that is produced by this exact code:

[Device] [RevMob] Starting RevMobAds Jul 16 04:25:00.280 [Device] ad phase: init Jul 16 04:25:01.421 [Device] ad phase: sessionStarted Jul 16 04:25:01.457 [Device] event phase: sessionStarted Jul 16 04:25:01.487 [Device] Invalid Parameter: URL argument was malformed URL Jul 16 04:25:01.487 [Device] [RevMob] Initializing Fullscreen. Jul 16 04:25:01.522 [Device] [RevMob] Fail with error: unsupported URL Jul 16 04:25:01.553 [Device] ad phase: failed Jul 16 04:25:01.588 [Device] rewardedVideo Jul 16 04:25:01.589 [Device] true Jul 16 04:25:01.589 [Device] unsupported URL - Error Code -1002

And this is my build.settings:

-- -- For more information on build.settings see the Corona SDK Build Guide at: -- http://docs.coronalabs.com/guide/distribution/buildSettings/index.html -- settings = { orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait", } }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, plugins = { ["plugin.revmob"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, --["plugin.adbuddiz"] = --{ -- publisherId = "com.adbuddiz" --}, --["plugin.supersonic"] = --{ -- publisherId = "com.coronalabs", -- supportedPlatforms = { iphone=true, android=true } --}, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, }, -- -- iOS Section -- iphone = { plist = { UIStatusBarHidden = true, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend NSAppTransportSecurity = { NSAllowsArbitraryLoads=true }, CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-167.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXX", -- replace XXXXXXXXX with your Facebook appId } } } --]] } }, -- -- Android Section -- android = { usesPermissions = { "android.permission.INTERNET", }, }, }

Hope that helps.

By the way, the ios ad is not live jet, but Android is…

Best,

Felix

Update:

I just saw that I was using a quite outdated version of corona and updated it to the latest daily build (2016.2913) and it shows one more message in the logs:

ad phase: init

CFNetwork SSLHandshate failed (-9806)

ad phase: sessionStarted

the rest of the logs stays the same…

Maybe this helps?

Update:

I just saw that when starting a session on the applicationResume event, I get the following log messages:

[RevMob] Testing mode off

[RevMob] Parallax effect disabled

These logs are produced by the following code:

 -- System event listener function local function onSystemEvent( event ) if ( event.type == "applicationResume" ) then -- Start a new RevMob session revmob.startSession() end end -- Add the system event listener Runtime:addEventListener( "system", onSystemEvent )

What is the Testing mode? What is the parallax effect?

Maybe this helps in finding the problem?

Best,

Felix

Thanks for the info Felix.

Just asking to be sure… you’re using a iOS specific media id when on iOS correct? 

Also, what version of iOS are you running on?

Hei Danny,

yes, I created a ios specific media id in the revmob panel. I verified this quite some times and also created new ones. No changes.

I am testing on an iPad mini running ios 9.3.2.

I will try on an iPhone later today. and I will also make an update to 9.3.3.

Best,

FElix

Hei Danny,

I tried it now on another device, I updated the OS to 9.3.3 and I even made a minimal app to see if it is something else in my code and I still get the same logs as in the beginning. Please see my complete app files below:

build.settings

-- -- For more information on build.settings see the Corona SDK Build Guide at: -- https://docs.coronalabs.com/guide/distribution/buildSettings -- settings = { orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait", }, }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, plugins = { ["plugin.revmob"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, }, -- -- iOS Section -- iphone = { plist = { NSAppTransportSecurity = { NSAllowsArbitraryLoads=true }, UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-167.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, }, }, -- -- Android Section -- android = { usesPermissions = { "android.permission.INTERNET", }, }, }

main.lua

----------------------------------------------------------------------------------------- -- -- main.lua -- ----------------------------------------------------------------------------------------- local revmob = require( "plugin.revmob" ) local text = display.newText("revmob test", 0,0, native.systemFont, 20) text.x = display.contentCenterX text.y = display.contentCenterY local function adListener( event ) print("ad phase: " .. event.phase) if ( event.phase == "init" ) then -- Successful initialization if event.isError then print( "isError: " .. event.isError ) elseif system.getInfo("platformName") == "Android" then print("loading ad ...") revmob.load( "rewardedVideo", "Rewarded Video" ) revmob.load( "interstitial", "Fullscreen" ) end elseif ( event.phase == "sessionStarted" ) then -- Successful initialization -- This only happens on iOS print("event phase: sessionStarted") revmob.load( "rewardedVideo", "Rewarded Video" ) revmob.load( "interstitial", "Fullscreen" ) elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded print( event.type ) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) --this is done when the player clicks the continue button elseif event.phase == "sessionFailed" then --I think this only happens on iOS when there is no connection at startup... timer.performWithDelay(40000, function() if system.getInfo("platformName") == "Android" then revmob.init( adListener, { appId="576f1744ba....de3bf9924e" } ) --android else revmob.init( adListener, { appId="5770527b3....9430b4b5242" } ) --ios end end) elseif (event.phase == "displayed") then revmob.load( "interstitial", "Fullscreen" ) elseif (event.phase == "rewardedVideoCompleted") then print("rewarded video watched...") revmob.load( "rewardedVideo", "Rewarded Video" ) end end -- Initialize RevMob if system.getInfo("platformName") == "Android" then revmob.init( adListener, { appId="576f1744ba....de3bf9924e" } ) --android else revmob.init( adListener, { appId="5770527b3....9430b4b5242" } ) --ios end

Here the logs produced by this code:

Jul 18 08:34:40.879 ---------- Device Log Starts ---------- Jul 18 08:34:59.986 [Device] Platform: iPad / iPad2,5 / 9.3.3 / PowerVR SGX 543 / OpenGL ES 2.0 IMGSGX543-124.1 / 2016.2913 / pt-BR | BR | pt\_BR | pt Jul 18 08:35:00.107 [Device] [RevMob] Starting RevMobAds Jul 18 08:35:00.489 [Device] ad phase: init Jul 18 08:35:01.474 [Device] ad phase: sessionStarted Jul 18 08:35:01.490 [Device] event phase: sessionStarted Jul 18 08:35:01.490 [Device] Invalid Parameter: URL argument was malformed URL [Device] [RevMob] Initializing Fullscreen. Jul 18 08:35:01.552 [Device] [RevMob] Initializing Fullscreen. Jul 18 08:35:01.638 [Device] [RevMob] Fail with error: unsupported URL Jul 18 08:35:01.655 [Device] ad phase: failed Jul 18 08:35:01.656 [Device] rewardedVideo [Device] true [Device] unsupported URL - Error Code -1002 Jul 18 08:35:01.835 [Device] [RevMob] Server response with (401) status code. Jul 18 08:35:01.858 [Device] ad phase: failed Jul 18 08:35:01.859 [Device] interstitial [Device] true [Device] The operation couldn’t be completed. (Server response with (401) status code. error -1.) - Error Code -1

I am lost, no more ideas what to test. Might it be related to the language or the country? I am in Brazil…

I can also send you my media ID, so you could test it from another region, if you think this might be the problem…

Best,

Felix

ps. I used version 2016.293 of the simulator to build the app, but the problem also occured when building with a way older version…

Hi Felix, did you solve your problem?

I’m thinking about the placementID value of your code. I used to use the ID provided by Revmob dashboard. There should be an ID for each of the Ad unit of an App. Press the “eye” icon under “actions” of the “Ad Unit” to check.

By the way, I have my problem applying the video ads of Revmob. It is for iOS only. Once the user click the Video Ad (when finished) and leave the App to Safari or AppStore, he can never load another ads when returned. 

Wilsonwansun,

thank you so much, I couldnt test it jet, but I am quite sure that this is the solution.

And I am kinda disappointed by the revmob guy, that responded me in the other thread (https://forums.coronalabs.com/topic/63813-revmob-media-id-app-id-placement-id-what/) where I asked this.

Now reading again, he told me exactly the same as you did, but I misinterpreted it the first time and it started working on Android…

Well, this is was a journey… hahaha. (I hope it ends here)

I will test this later and will update this and the other thread.

Thanks again for chipping in!

Best,
Felix

ps. I cant tell anything about your problem jet, will see if I can reproduce it, when the ads are up and running…

Wilsonwansun,

thank you so much! It really was the problem…

(I already was wondering how you could create different ads of the same type, when using the media ID that I was using…)

Now I only need to await some ads to appear (“No Ads available for this device/country at this moment.”)

Thanks again, to everybody that helped.

Best,

Felix

Was there more to the device’s console log?

Hello Rob,

thanks for you attention.

No there is nothing more than this.

Any idea where to get more information? Is there a debug flag for revmob?

Best,

Felix

Now I tried to load an interstitial Ad and got the following logs:

[RevMob] Starting RevMobAds ad phase: init ad phase: sessionStarted -- trying to load interstitial here, code: revmob.load( "interstitial", "Fullscreen" ) [RevMob] Initializing Fullscreen. [RevMob] Server response with (401) status code. ad phase: failed event type: interstitial event isError: true event response: The operation couldn’t be completed. (Server response with (401) status code. error -1.) - Error Code -1

My guess is that in case of the rewarded video the space in “Rewarded Video” is causing the malformed Url, but I hardly believe that I am the only one using rewarded videos on revmob or that I am the first to experience this problem. Anyway, I have no clue what this new error means :confused:

Other thing. On Android I have no [RevMob] logs at all. (Like [RevMob] Initializing Fullscreen)

Felix

Hey Felix.

The Revmob plugin is in use by a bunch of developers and is known to work on supported devices.

Due to this, can you provide me a sample of how you are using it?

Generally these problems are down to incorrect parameters or ids.

Thank you

Hei Danny, thanks for looking into this.

This is my code that works on Android, but not on iOS

local function adListener( event ) print("ad phase: " .. event.phase) if ( event.phase == "init" ) then -- Successful initialization if event.isError then print( "isError: " .. event.isError ) elseif globals.platform == "Android" or globals.platform == "Win" then print("loading ad ...") revmob.load( "rewardedVideo", placementID ) end elseif ( event.phase == "sessionStarted" ) then -- Successful initialization -- This only happens on iOS print("event phase: sessionStarted") --revmob.load( "banner", "Banner" ) --Banner revmob.load( "rewardedVideo", placementID ) elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded print( event.type ) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) --this is done when the player clicks the continue button --timer.performWithDelay(30000, function() revmob.load( "rewardedVideo", placementID ) end) elseif (event.phase == "rewardedVideoCompleted") then print("rewarded video watched...") revmob.load( "rewardedVideo", placementID ) countingDown = true local numPoints = 3 local function addPoints() numPoints = numPoints-1 if numPoints \>= 0 and points \< curWorldPoints then makeRing("in") timer.performWithDelay(500, function() points = points + 1 collisionAnimation(50) if mode == "survivalMode" then pointsText.text = points else pointsText.text = curWorldPoints-points end checkLevel() addPoints() end) else timer.performWithDelay(500, function() countingDown = false if points \< curWorldPoints then startFct() end end) end end gameOverGroup:toBack() timer.performWithDelay(500, function() addPoints() end) end end -- Initialize RevMob if globals.platform == "Android" or globals.platform == "Win" then revmob.init( adListener, { appId="576f1744ba2d1fde3bf9924e" } ) --576f1744ba2d1fde3bf9924e continue video android else revmob.init( adListener, { appId="5770527b36dd49430b4b5242" } ) --5770527b36dd49430b4b5242 continue video ios end

Here again the log that is produced by this exact code:

[Device] [RevMob] Starting RevMobAds Jul 16 04:25:00.280 [Device] ad phase: init Jul 16 04:25:01.421 [Device] ad phase: sessionStarted Jul 16 04:25:01.457 [Device] event phase: sessionStarted Jul 16 04:25:01.487 [Device] Invalid Parameter: URL argument was malformed URL Jul 16 04:25:01.487 [Device] [RevMob] Initializing Fullscreen. Jul 16 04:25:01.522 [Device] [RevMob] Fail with error: unsupported URL Jul 16 04:25:01.553 [Device] ad phase: failed Jul 16 04:25:01.588 [Device] rewardedVideo Jul 16 04:25:01.589 [Device] true Jul 16 04:25:01.589 [Device] unsupported URL - Error Code -1002

And this is my build.settings:

-- -- For more information on build.settings see the Corona SDK Build Guide at: -- http://docs.coronalabs.com/guide/distribution/buildSettings/index.html -- settings = { orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait", } }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, plugins = { ["plugin.revmob"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, --["plugin.adbuddiz"] = --{ -- publisherId = "com.adbuddiz" --}, --["plugin.supersonic"] = --{ -- publisherId = "com.coronalabs", -- supportedPlatforms = { iphone=true, android=true } --}, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, }, -- -- iOS Section -- iphone = { plist = { UIStatusBarHidden = true, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend NSAppTransportSecurity = { NSAllowsArbitraryLoads=true }, CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-167.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXX", -- replace XXXXXXXXX with your Facebook appId } } } --]] } }, -- -- Android Section -- android = { usesPermissions = { "android.permission.INTERNET", }, }, }

Hope that helps.

By the way, the ios ad is not live jet, but Android is…

Best,

Felix

Update:

I just saw that I was using a quite outdated version of corona and updated it to the latest daily build (2016.2913) and it shows one more message in the logs:

ad phase: init

CFNetwork SSLHandshate failed (-9806)

ad phase: sessionStarted

the rest of the logs stays the same…

Maybe this helps?