Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Hide iAd until Ad is ready

I've just gotten my first app with iAds rejected from Apple because the iAd block needs to be disabled when no ads are being displayed. I have modified the TiUIiOSAdView.m file referenced here:
http://github.com/appcelerator/titanium_mobile/commit/782d970f785fd3cb3bfe4fbfdb479089b9aa2869

[self.proxy replaceValue:NUMBOOL(NO) forKey:@"visible" notification:YES];

But the iAd still appears when no network is available (Airplane Mode). I must be missing something else? Anyone have some advise?

— asked July 8th 2010 by Andrew Flocchini
  • iad
  • iphone
0 Comments

9 Answers

  • I found out the iAd view hides itself in the simulator but not on my iPod Touch 2G. I'll re-submit it and see what Apple says.

    — answered July 8th 2010 by Andrew Flocchini
    permalink
    3 Comments
    • What Ti SDK version did you use to submit? (I assume 1.3.3?)

      — commented July 8th 2010 by karlo kilayko
    • Yes, I updated all the files to be 1.3.3. Is there a spot, besides github, to DL these?

      — commented July 9th 2010 by Andrew Flocchini
    • AFAIK, github is the place

      — commented July 10th 2010 by karlo kilayko
  • Karlo - As far as I'm aware there is no 1.3.3 so it would have been submitted with 1.3.2.

    I would also like to know what to do with this. I submitted a update with iAds last week with out the "fix" in it so I'm assuming its going to get rejected.

    I placed the fix in the app and ran it but do not notice any difference, I still get the white box when there is no network connection.

    — answered July 8th 2010 by donovan lewis
    permalink
    2 Comments
    • I'll update this with Apple's response when I hear back.

      — commented July 8th 2010 by Andrew Flocchini
    • Ah, I assumed the OP built 1.3.3 and used that so he had the latest and greatest.

      — commented July 8th 2010 by karlo kilayko
  • Are you able to detect a network connection with Ti.Network and manually hide iAds?

    — answered July 8th 2010 by Kevin Whinnery
    permalink
    1 Comment
    • I did try that but I'm not sure if that's what they want. They say "when an ad is not available." does that mean no network connection or before the ad has fully loaded? I'll see what they say this time and if I need to, submit another version with code also.

      — commented July 8th 2010 by Andrew Flocchini
  • @Kevin

    I think apple wants it to go away when there server will not display an ad on the end user. I don't think it really matters to them if there is no network connection. I will see if they reject my app based on this same issue. It's at the review stage right now.

    — answered July 8th 2010 by donovan lewis
    permalink
    0 Comments
  • I just had my app rejected by apple because of this. They tell me to add the code from the error handling section on this page https://developer.apple.com/iphone/prerelease/library/documentation/UserExperience/Conceptual/iAd_Guide/WorkingwithBannerViews/WorkingwithBannerViews.html

    I submitted a update using the code from http://github.com/appcelerator/titanium_mobile/commit/782d970f785fd3cb3bfe4fbfdb479089b9aa2869

    I saw it work a few times in the simulator but never on the phone.

    Does anyone have a answer on what we should be using to fix this problem?

    Thanks

    — answered July 9th 2010 by donovan lewis
    permalink
    1 Comment
    • You're in the same boat as me then. I hope this gets sorted soon so I can get my app up. I was all excited about trying out iAds.

      — commented July 9th 2010 by Andrew Flocchini
  • what about this?

    Add load event to createAdView, and show it if it does. It seems to response to load event, anyone from TI care to comment how iad works?

    — answered July 10th 2010 by Daniel Lim
    permalink
    0 Comments
  • Just got word, an upgrade to my iphone app with iAd integration approved! :)

    It was built with 1.3.2 and updated with http://github.com/appcelerator/titanium_mobile/commit/782d970f785fd3cb3bfe4fbfdb479089b9aa2869

    I also add load event ( i mentioned below) to show the view container which contain the iAd object, i was shooting in a dark but got approved anyway. :)

    — answered July 20th 2010 by Daniel Lim
    permalink
    5 Comments
    • Congrats Daniel! That is great! Can you give more details on your solution. What do you mean "add load event to createAdView"? Thanks!

      — commented July 20th 2010 by karlo kilayko
    • Hi Karlo,

      I show it on article, create the ad, add on a view objects at bottom -100 (to hide it below screen) then add load eventlistener to the ad, when load, animate the view object to bottom:0. If the ad never load, it will not occupy the screen as it's hidden below.

      — commented July 20th 2010 by Daniel Lim
    • Oh forgot to mention, the load event trigger every 30-40 seconds or so. It seems like Apple is refreshing the ad periodically.

      — commented July 20th 2010 by Daniel Lim
    • Ah, that's very cool. Do you show anything in the "blank" space when the ad doesn't display?

      — commented July 20th 2010 by karlo kilayko
    • Nope, there's still work need to be done as the behavior is only being observed on a test ad. For instance, if i keep the window on for few minutes, on ad next refresh, it's blank. i suppose that's where the "code" hide the ad when no ad ready. Now, what can we do on code end to reanimate the view when ad is blank on next refresh? We need more eventlistener handler, so far, the load event is not even documented.

      — commented July 20th 2010 by Daniel Lim
  • My app has also been approved using the Titanium 1.4 SDK and the following event listener code for my iAd's

    var win = Titanium.UI.createWindow();
    
    iads = Ti.UI.iOS.createAdView({
        width: 'auto',
        height: 'auto',
        top: -100,
        borderColor: '#000000',
        backgroundColor: '#000000'}); 
    
        t1 = Titanium.UI.createAnimation({top:0, duration:750}); 
    
        iads.addEventListener('load', function(){
            iads.animate(t1);
        }); 
    
    win.add(iads);
    
    — answered August 6th 2010 by Andrew Flocchini
    permalink
    0 Comments
  • Thanks for the info. Please update any new findings :-)

    — answered August 7th 2010 by Peter Lum
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.