2013-03-19 28 views
6

mã của tôi làrequiredContentSizeIdentifiers bị phản

-(void)viewDidLoad 
{ 
    adView = [[ADBannerView alloc] initWithFrame:CGRectZero]; 
    adView.frame = CGRectOffset(adView.frame, 0, -50); 
    adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait]; 
    adView.currentContentSizeIdentifier =ADBannerContentSizeIdentifierPortrait; 
    [self.view addSubview:adView]; 
    adView.delegate=self; 
    self.bannerIsVisible=NO; 

    [super viewDidLoad]; 

} 

//when banner is loaded successfully 
- (void)bannerViewDidLoadAd:(ADBannerView *)banner 
{ 
    if (!self.bannerIsVisible) 
    { 
     [UIView beginAnimations:@"animateAdBannerOn" context:NULL]; 
     // banner is invisible now and moved out of the screen on 50 px 
     banner.frame = CGRectOffset(banner.frame, 0, 50); 
     [UIView commitAnimations]; 
     self.bannerIsVisible = YES; 
    } 
} 

//when any problems occured 
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error 
{ 
    if (self.bannerIsVisible) 
    { 
     [UIView beginAnimations:@"animateAdBannerOff" context:NULL]; 
     // banner is visible and we move it out of the screen, due to connection issue 
     banner.frame = CGRectOffset(banner.frame, 0, -50); 
     [UIView commitAnimations]; 
     self.bannerIsVisible = NO; 
    } 
} 

currentContentSizeIdentifier 

requiredContentSizeIdentifiers 

ADBannerContentSizeIdentifierPortrait 

bị phản đối, vì vậy những gì tôi thay thế nó bằng, vì vậy nó sẽ vẫn làm việc?

Tôi cần thực hiện việc này trước khi gửi, bởi vì nếu không, ứng dụng sẽ bị từ chối.

Xin hãy giúp tôi

Cảm ơn trước

+0

Bạn nói đây là một câu hỏi trùng lặp, nhưng câu hỏi của tôi không nhận được trả lời – user2167312

Trả lời

12

Nếu bạn loại bỏ các dòng vi phạm mã và thực hiện một trong những dưới đây, nó sẽ đạt được kết quả tương tự, nhưng nó không bị phản đối.

Remove:

adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait]; 
adView.currentContentSizeIdentifier =ADBannerContentSizeIdentifierPortrait; 

Add:

[adView setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; 
+0

này không thực sự giải quyết vấn đề này. Nếu bạn đã xóa các dòng mã đó và thêm NOTHING, mã của bạn sẽ vẫn hoạt động tốt. Đây không phải là sự thay thế thực sự cho 'requiredContentSizeIdentifiers', nếu bạn đã đặt chúng thành dạng ngang, chứ không phải dọc, và thử thay thế mã bằng mã ở trên, bạn sẽ thấy rằng ứng dụng của bạn bắt đầu vi phạm. –

0

iOS 6 đi kèm với nhiều cập nhật mới. Có rất nhiều điều khiển tự động không được chấp nhận. ADBannerContentSizeIdentifierPortrait cũng không còn được dùng nữa.

Đây là liên kết sẽ giúp bạn giải quyết vấn đề này.

autolayout example

Các vấn đề liên quan