1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

More iOS 6.0 troubles

Discussion in 'iPhone/iPad Programming' started by samdev, Sep 20, 2012.

  1. macrumors regular

    #1
    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. macrumors 68000

    Reason077

    #2
    I have not seen any problems with ADBannerView in iOS 6. didFailToReceiveAdWithError is called for me when there is no internet connection.
     
  3. Moderator

    dejo

    Staff Member

    #3
    I, too, am getting a frequent
    Code:
    ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:)
     
  4. macrumors regular

    #4
    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. macrumors newbie

    #5
    What does your code look like ?
     
  6. macrumors regular

    #6
    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.

    Code:
    @interface MyViewController : UIViewController <ADBannerViewDelegate> {
    
    Allocate banner and add it to the view:
    Code:
           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:
    Code:
    -(void)bannerViewDidLoadAd:(ADBannerView *)banner;
    -(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error;
    
     
  7. macrumors regular

    #7

    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:

    Code:
           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. macrumors 68000

    Reason077

    #8
    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. macrumors regular

    nickculbertson

    #9
    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. macrumors regular

    #10
    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. macrumors 68000

    Reason077

    #11
    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. macrumors 68030

    PhoneyDeveloper

    #12
    @samdev, you're asking

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

    You probably need something like:

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

    #13
    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