2010-06-26 2 views
2

누구든지이 문제에 대해 약간의 도움을 줄 수 있습니까? 방금 광고가 게재되지 않을 때 표시되는 광고 배너가 포함되어 있기 때문에 내 앱을 수락 할 수 없다는 Apple의 의견을 받았지만이 문제를 방지하기 위해해야 ​​할 일이 무엇인지 알 수 없습니다.광고가 게재되지 않을 때 iAd 배너를 숨기려면 어떻게해야합니까?

[QUOTE]

We've completed the review of your application; however, we cannot post this version to the App Store because it displays an empty iAd banner when ad content is not available. The banner within the app should be hidden whenever ad content is not being served by iAd. We have included additional details below to help explain the issue. We hope that you'll consider revising and resubmitting your application.

To handle the case where ad content is not available, you will need to implement a banner view delegate. An example code snippet is included here for your convenience. Additionally, you may wish to review the section "Working with Banner Views" of the iAd Programming Guide for specific details: https://developer.apple.com/iphone/prerelease/library/documentation/UserExperience/Conceptual/iAd_Guide/WorkingwithBannerViews/WorkingwithBannerViews.html

Banner View Delegate to Remove a Banner View When Advertisements are Not Available:

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error 
{ 
    if (self.bannerIsVisible) 
    { 
     [UIView beginAnimations:@"animateAdBannerOff" context:NULL]; 
// assumes the banner view is at the top of the screen. 
     banner.frame = CGRectOffset(banner.frame, 0, -50); 
     [UIView commitAnimations]; 
     self.bannerIsVisible = NO; 
    } 
} 
이제

제가 옆 널빤지를 고민하고있어 내가에 넣어 시도했습니다 때, 그 코드와 함께 할 것입니다 그냥 던져 여러 빨간색 오류 내가 와서 너무 조언을 구하는 사람, 나를 도울 수있는 사람은 누구입니까?

편집 : 홈페이지의 ViewController 코드 포스터의 요청에 따라

// 
// MainViewController.m 
// GBSoundboard4 
// 
// Created by David Clarke on 19/06/2010. 
// Copyright __MyCompanyName__ 2010. All rights reserved. 
// 

#import "MainViewController.h" 
#import <AVFoundation/AVAudioPlayer.h> 

@implementation MainViewController 
-(IBAction)goodafternoon { 
    NSString *path = [[NSBundle mainBundle] pathForResource:@"goodafternoon" ofType:@"wav"]; 
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL]; 
    [theAudio play]; 
} 

-(IBAction)jollygood { 
    NSString *path = [[NSBundle mainBundle] pathForResource:@"jollygood" ofType:@"wav"]; 
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL]; 
    [theAudio play]; 
} 
-(IBAction)playSound { 
    NSString *path = [[NSBundle mainBundle] pathForResource:@"goodmorning" ofType:@"wav"]; 
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL]; 

    [theAudio play]; 
} 

-(IBAction)upgrade { 
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/gb/app/the-great-british-soundboard/id376263018?mt=8"]]; 
} 



/* 
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 
- (void)viewDidLoad { 
    [super viewDidLoad]; 
} 
*/ 


- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller { 

    [self dismissModalViewControllerAnimated:YES]; 
} 


- (IBAction)showInfo:(id)sender {  

    FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil]; 
    controller.delegate = self; 

    controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
    [self presentModalViewController:controller animated:YES]; 

    [controller release]; 
} 


- (void)didReceiveMemoryWarning { 
    // Releases the view if it doesn't have a superview. 
    [super didReceiveMemoryWarning]; 

    // Release any cached data, images, etc. that aren't in use. 
} 


- (void)viewDidUnload { 
    // Release any retained subviews of the main view. 
    // e.g. self.myOutlet = nil; 
} 


/* 
// Override to allow orientations other than the default portrait orientation. 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations. 
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
} 
*/ 


- (void)dealloc { 
    [super dealloc]; 
} 


@end 
+0

당신이 나를 도울 수 .. http://stackoverflow.com/questions/5953418/implementation-for-iad – ajay

답변

1

WWDC 2010 세션 비디오 112에서 이것을 구현하는 방법에 대한 훌륭한 예가 있습니다. iPhone 개발자 프로그램에 등록한 경우 아래에 설명 된대로 iTunes University에서 다운로드 할 수 있습니다.

귀하가 Apple 개발자 프로그램에 참여한다고 가정하면 "모든 사용자를위한 WWDC"란 제목의 전자 메일이 전송되었습니다. iTunes University에 접속할 때까지 이메일에있는 링크를 따라 가십시오. 그런 다음 프레임 워크 링크를 따라 세션 112를 선택하십시오. 구현은 대략 25 분 정도 걸렸습니다.

+0

당신은 오히려 이런 종류의 일반 정보보다 해결책을 줄 것입니다 –

+0

일반 정보 또는 아닙니다 정확한 답변을 제공합니다. 훌륭한. – David26th

+1

이 작업은 Tableview 컨트롤러에서만 수행하는 방법을 보여줍니다. 테이블이없는 UIViewController는 무엇입니까? – Jason

4

당신이해야 할 것은이 이벤트 입니다 - (무효) bannerView : (ADBannerView *) 배너 didFailToReceiveAdWithError :

(* NSError )

배너보기를 사용하여보기를 만들려면 화면의 배너보기 공간을 차지하도록 프레임의 크기를 조정하고 화면 외부에 bannerView 프레임의 원점을 이동 시키십시오.

B 다음에 - (무효) bannerViewDidLoadAd : (ADBannerView *) 배너

는 BannerView위한 공간을 확보하고 화면의 공간으로 다시 bannerView 프레임의 원점을 이동보기를 크기를 조정합니다.

+0

조언을 주셔서 감사합니다,하지만 당신은 조금 더 구체적으로 어디에 도움이 될 수 있습니까? 이것이 내가 가장 고심하고있는 것입니다. 광고가 없다면 AdBannerView를 근본적으로 압박한다는 개념에 감사드립니다. 광고가 없으면 다시 끌어 당깁니다. 코드를 어디에 넣을 지 짐작할 수 없습니다. 이것을하기 위해. – David26th

+0

보기 및 bannerView를 제어하는보기 컨트롤러 코드를 표시하지 않으면 더 이상 지원할 수 없습니다. –

+0

괜찮을거야. 잠시만 기다려. – David26th

0

정확히 무엇을 설명해야합니다. 먼저 MainViewController를 ADBannerView 인스턴스의 대리자로 만들어야합니다. 그런 다음 코드를 복사하여 MainViewController의 구현에 붙여 넣기 만하면됩니다. 배너가 화면 하단에 표시된다고 가정합니다. 상단에 나타나면 제공 한 코드에서 애니메이션의 방향을 반대로합니다.

배너가 광고를로드하지 못한 경우 (서비스가 실제로 실행되는 7 월 1 일까지, 그리고 네트워크에 연결되지 않았거나 인벤토리가 삭제 된 경우에도 해당 광고가로드되지 않는 경우)이 위임 방법이 호출됩니다. 또한 ADBannerViewDelegate protocol에 설명 된 다른 위임 콜백에 응답 할 수 있습니다.

제안 된대로이 내용은 iAd Programming Guide의 해당 섹션에서 다룹니다.

+0

맞아요. 아직 예상되는 결과를 얻지 못해서이 단계를 명확히해야합니다. IB에서 광고 배너를 클릭하고 대리인 '벨'을 파일 소유자에 연결합니다. 그런 다음 적절한 viewcontroller.m 파일에 코드 스 니펫을 붙여 넣습니다. .h 파일에서 같은 것을 시도하면 두 가지 오류 메시지가 표시됩니다. 그러나 두 가지만 제공하지만 오히려 두려운 것 같습니다. 여기 희미한 ... 처음으로 나는 이런 식으로해야만했다. 앱의 나머지 부분은 정상적으로 실행되며 행복하게 출시 될 수 있지만 광고는 앱 자체에 비용을 청구하지 않고 수익을 창출 할 수있는 방법을 제공합니다. – David26th

+0

@ David26th - 너무 가혹하지 않으면 서 일반적으로 코코아와 Objective-C에 익숙하지 않은 것처럼 들리므로, 응용 프로그램에 대한 응용 프로그램을 제출하기 전에 플랫폼에 익숙해지는 시간을 조금 더 보냅니다. 저장. 조금 더 이해하면 폴란드어가 더 커질 수 있으므로 사용자 환경이 개선 될 수 있습니다. 특히 Cocoa Fundamentals Guide (http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html)를 읽으십시오. 특히 위임자 섹션을 참조하십시오. –

+0

@ David26th - 그들이 당신에게 제공 한 것은 델리게이트 메소드의 구현입니다. MainViewController.m에서이 메소드 구현을 배치 할 때 어떤 컴파일 오류가 발생했는지에 대한 설명이 없으면 우리가 여러분을 도울 수 없습니다. MainViewController가 ADBannerViewDelegate 프로토콜을 따르고 iAd 프레임 워크에 링크되어 있음을 나타내야하지만 그 이상의 경우 무엇이 잘못 될지 추측 할 수 없습니다. –

관련 문제