【问题标题】:Having trouble using custom class as a type within App Delegate在 App Delegate 中使用自定义类作为类型时遇到问题
【发布时间】:2012-08-08 01:19:09
【问题描述】:

我正在尝试为整个 ios 应用程序中的视图控制器制作一个共享的 iAd 横幅视图。为了做到这一点,我一直试图在我的应用程序委托中创建一个单例类,但我一直收到错误消息,“接口类型'iAdClass'不能按值返回。”我不知道如何解决这个问题,我对单例的设置也可能不正确,所以任何帮助也将不胜感激。

#import <UIKit/UIKit.h>


@class ViewController;
@class iAdClass;

@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) ViewController *viewController;

@property (assign) iAdClass*iADObject;
+ (AppDelegate*) sharedApplication;
+ (iAdClass)sharedAd;

@end

【问题讨论】:

  • 谢谢,不知道为什么我没有注意到。

标签: xcode class types singleton iad


【解决方案1】:

您好,我这样做了,但如果没有互联网连接,则找不到如何删除添加

How to create a global reference for iAd and implement in multiple Viewcontrollers

【讨论】:

  • 您是否有一个无法正常工作的 didFailToReceiveAdWithError 方法?如果是这种情况,您可以尝试在 viewDidLoad 中默认将 adBanner 设置为关闭屏幕(看不见),然后仅在正确调用您的 bannerViewDidLoad 方法时才显示它。这样,如果由于某种原因无法显示广告,它将默认关闭屏幕。
猜你喜欢
  • 1970-01-01
  • 2020-07-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-31
相关资源
最近更新 更多