More iOS 6.0 troubles

Discussion in 'iOS Programming' started by samdev, Sep 20, 2012.

  1. samdev macrumors regular

    Sep 16, 2011
    Just downloaded XCode 4.5 and iOS 6.0, and already experiencing some troubles after compiling my app.
    I'm using the simulator.

    First, ADBannerView is not firing anymore when there isn't an Internet connection.
    Specifically, didFailToReceiveAdWithError is not being called. This can be used to hide
    your banner if it's not needed.

    Secondly, I'm playing some sound effects using OpenAL, and maybe after 5 minutes or so,
    all of my sounds start to become corrupt. They sound like their being crunched to death.
    Really horrible.

    And already posted a thread on getting some unexpected behavior from sizeToFit.

    This is all on the iOS 6.0 simulator. No problems on iOS 5.0.

    Just wondering if anybody is experiencing the same problems.
  2. Reason077 macrumors 68020


    Aug 14, 2007
    I have not seen any problems with ADBannerView in iOS 6. didFailToReceiveAdWithError is called for me when there is no internet connection.
  3. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    I, too, am getting a frequent
    ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:)
  4. samdev thread starter macrumors regular

    Sep 16, 2011
    That sounds like a different problem than mine.

    With iOS 5, didFailToReceiveAdWithError is continuously called when there is no Internet connection.
    Now, with iOS 6.0, it's never called.

    And the problem with sounds is even worst. If I leave my app running for maybe 10 or more minutes, the sound completely goes silent.

    It's like a slow death.
  5. Prohapps macrumors newbie

    Jul 1, 2010
    Vancouver, BC, Canada
  6. samdev thread starter macrumors regular

    Sep 16, 2011
    I don't see anything wrong with my banner code.

    To get it compiled with iOS 6.0, I had to comment out two lines.

    @interface MyViewController : UIViewController <ADBannerViewDelegate> {
    Allocate banner and add it to the view:
           ADBannerView *tmp = [[ADBannerView alloc] initWithFrame:CGRectZero];
           tmp.frame = CGRectOffset(tmp.frame, 0, -50);
           tmp.delegate = self;
           // Depreciated in iOS 6.0
           //tmp.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
           //tmp.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
           [self.view addSubview:tmp];
           [tmp release];
    Delegate methods added:
    -(void)bannerViewDidLoadAd:(ADBannerView *)banner;
    -(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error;
  7. samdev thread starter macrumors regular

    Sep 16, 2011

    More specifically, didFailToReceiveAdWithError is not being called when the simulator device
    is set to iPhone (Retina 3.5-inch) or iPhone (Retina 4-inch).

    I see that ADBannerView has a new initializer called initWithAdType, so I tried that and
    it still doesn't get called.

    The iOS 5.0 simulator will also crash if calling initWithAdType, so I tried the following:

           ADBannerView *tmp = NULL;
            if( [tmp respondsToSelector:@selector(initWithAdType:)]) {
              tmp = [[ADBannerView alloc] initWithAdType:ADAdTypeBanner];      // iOS 6.0
           else {
              tmp = [[ADBannerView alloc] initWithFrame:CGRectZero];	// iOS 5.0
    But the respondsToSelector line does not return YES when running iOS 6.0.
    I don't know why.
  8. Reason077 macrumors 68020


    Aug 14, 2007
    Upon further investigation, my app doesn't appear to be receiving any iAds (or test iAds) with iOS 6. Test Ads were working fine in the iOS 6 betas, but now not in the GM. Ads still working fine on 4.3.5 and 5.1.1.

    My didFailToReceiveAdWithError is firing, however, giving either "Unknown Error" or "Ad inventory unavailable".
  9. nickculbertson macrumors regular


    Nov 19, 2010
    Nashville, TN
    I think we are all in the same boat. There is much discussion on this in the apple devforums. Apparently some developers experienced similar problems when iOS 5 came out (I don't remember having any though). Apple gains revenue from those ads as well. Things will probably be fixed soon. Between iOS 6, iPhone 5 release, botched map app, and now this I'd say their hands are pretty full at the moment.
  10. samdev thread starter macrumors regular

    Sep 16, 2011
    Well, putting the first problem aside, is this the correct way to use respondsToSelector ?

    I need to initialize ADBannerView for both iOS 5 and 6, and initWithAdType only exists on iOS 6.
    But, it's not working. The respondsToSelector line doesn't return "YES".
  11. Reason077 macrumors 68020


    Aug 14, 2007
    There isn't any reason why you need to use initWithAdType, is there? The banner type is the default anyway. Just dont use it if you want the app to be backwards-compatible.
  12. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    @samdev, you're asking

    if( [NULL respondsToSelector:@selector(initWithAdType:)])
    and the answer is NO. NULL doesn't respond to any selectors.

    You probably need something like:

    if( [[ADBannerView class] instancesRespondToSelector:@selector(initWithAdType:)])
    but I haven't used this view.
  13. samdev thread starter macrumors regular

    Sep 16, 2011
    Thanks, that makes sense now.

    I was thinking I had to call initWithAdType with iOS 6.0, otherwise my banner would be locked in portrait mode.
    But I guess that doesn't matter.

Share This Page