我正在开发一个简单的应用程序,我实现了iAd Banner View。如果我运行该代码我得到错误,我的代码没有错误 “操作无法完成。应用程序有iAd网络配置错误”我想知道错误背后的原因是什么。我正在使用XCode 4.2和iOS 5模拟器。
这是我写的代码。
-(void)moveBannerViewOffScreen
{
CGRect originalTableViewFrame = self.tableView.frame;
CGFloat newTableHeight = self.view.frame.size.height;
CGRect newTableFrame = originalTableViewFrame;
newTableFrame.size.height = newTableHeight;
CGRect newBannerFrame = self.bannerView.frame;
newBannerFrame.origin.y = newTableHeight;
self.tableView.frame = newTableFrame;
self.bannerView.frame = newBannerFrame;
}
-(void)moveBannerViewOnScreen
{
CGRect newBannerFrame = self.bannerView.frame;
newBannerFrame.origin.y = self.view.frame.size.height - newBannerFrame.size.height;
CGRect originalTableFrame = self.tableView.frame;
CGFloat newTableHeight = self.view.frame.size.height - newBannerFrame.size.height;
CGRect newTableFrame = originalTableFrame;
newTableFrame.size.height = newTableHeight;
[UIView beginAnimations:@"BannerViewIntro" context:NULL];
self.tableView.frame = newTableFrame;
self.bannerView.frame = newBannerFrame;
[UIView commitAnimations];
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
[self moveBannerViewOffScreen];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}
-(void)bannerViewDidLoadAd:(ADBannerView *)banner
{
[self moveBannerViewOnScreen];
NSLog(@"Success");
}