Help With Iads

Hello. I don’t understand what I’m doing wrong since there are only like 5 lines of code…I feel like I’m retarded today.

http://www.coronalabs.com/blog/2013/01/01/using-iads-in-corona/

I followed that, but really there are only 5 lines of code or so…can someone tell me what I might be missing

ads = require( "ads" ) function adListener(event) msg = event.response     if event.isError then     audio.play( errorSound )     end end ads.init( "iads", "com.yourcompany.yourappid", adListener ) ads:setCurrentProvider("iads") ads.show( "banner", { x=0, y=0 } )

I understand that it follows my Bundle ID which I’m sure I got right. I do have a question though, I only accepted the iAds Terms of Service or whatevre recently and got approved. I have the iAds are Live green button, but I wanted to test on my iphone and can’t get it to work at all? I created a new distribution profile with Ad Hoc and the same bundle id as my app, is that why it’s not working? Help would be greatly appreciated.

Hi there,

I haven’t tried it specifically with an ad hoc distribution, so I can’t speak to that part.  But your code above looks fine to me.  Do you also specify your bundle identifier in the plist in your build.settings, using the CFBundleIdentifier key?

Do you see any error messages when you build the code, or any relevant messages in the console when you run it?

  • Andrew

Hey Andrew, thanks for the reply.

  Unfortunately I still haven’t managed to get it to work. I actually did not have CFBundleIdentifier in my plist (was so excited and hoped it would do the trick), but it didn’t change anything at all. As for any types of errors, there are none in the console nor when I build the code. I was using Ad Hoc because the other option is App Store which doesn’t let me specify any devices, thus not allowing me to sync that build on any device at all. You wouldn’t happen to have any other ideas? Hehe. Thanks again for reading, sorry for the trouble.

Hi there,

Instead of an ad hoc build, have you tried using a regular development build?

  • Andrew

I was attempting to try that before I posted but development build didn’t work. After reading your latest post though I tried again and realized I never restarted corona after installing the certificate, my bad. But even with the development build it still does not work, nothing loads.

I just went ahead and checked my Location Services is on so it should know I’m located in California therefor it should load ads? The weird thing is, I set it to play a sound if any type of error happens but that never happens either. I need to check with a fail to load event once I find it.

Hi there,

Rather than using a sound, try inserting some print statements within your adListener function.  That way, you can at least see if the function is receiving the callback, as it’s supposed to.

You could insert code like this to print out the contents of the event table, which might also give you insight into what is going wrong.

[lua]

for key,value in pairs(event) do

   print(key,value)

end

[/lua]

  • Andrew

Hi there,

I haven’t tried it specifically with an ad hoc distribution, so I can’t speak to that part.  But your code above looks fine to me.  Do you also specify your bundle identifier in the plist in your build.settings, using the CFBundleIdentifier key?

Do you see any error messages when you build the code, or any relevant messages in the console when you run it?

  • Andrew

Hey Andrew, thanks for the reply.

  Unfortunately I still haven’t managed to get it to work. I actually did not have CFBundleIdentifier in my plist (was so excited and hoped it would do the trick), but it didn’t change anything at all. As for any types of errors, there are none in the console nor when I build the code. I was using Ad Hoc because the other option is App Store which doesn’t let me specify any devices, thus not allowing me to sync that build on any device at all. You wouldn’t happen to have any other ideas? Hehe. Thanks again for reading, sorry for the trouble.

Hi there,

Instead of an ad hoc build, have you tried using a regular development build?

  • Andrew

I was attempting to try that before I posted but development build didn’t work. After reading your latest post though I tried again and realized I never restarted corona after installing the certificate, my bad. But even with the development build it still does not work, nothing loads.

I just went ahead and checked my Location Services is on so it should know I’m located in California therefor it should load ads? The weird thing is, I set it to play a sound if any type of error happens but that never happens either. I need to check with a fail to load event once I find it.

Hi there,

Rather than using a sound, try inserting some print statements within your adListener function.  That way, you can at least see if the function is receiving the callback, as it’s supposed to.

You could insert code like this to print out the contents of the event table, which might also give you insight into what is going wrong.

[lua]

for key,value in pairs(event) do

   print(key,value)

end

[/lua]

  • Andrew