[英]No visible @interface for 'JSQSystemSoundPlayer' error
[英]No visible @interface for 'GADUNativeCustomTemplateAd' error
我得到的错误是:
“ GADUNativeCustomTemplateAd”没有可见的@interface声明选择器“ performClickOnAssetWithKeycustomClickHandler:clickHandler:”
谁能帮我解决这个问题?
// Copyright 2014 Google Inc. All Rights Reserved.
#import "GADUNativeCustomTemplateAd.h"
@implementation GADUNativeCustomTemplateAd
- (instancetype)initWithAd:(GADNativeCustomTemplateAd *)nativeCustomTemplateAd {
self = [super init];
if (self) {
_nativeCustomTemplateAd = nativeCustomTemplateAd;
}
return self;
}
- (NSString *)templateID {
return [self.nativeCustomTemplateAd templateID];
}
- (NSString *)stringForKey:(NSString *)key {
return [self.nativeCustomTemplateAd stringForKey:key];
}
- (UIImage *)imageForKey:(NSString *)key {
return [self.nativeCustomTemplateAd imageForKey:key].images;
}
- (void)performClickOnAssetWithKey:(NSString *)key withCustomClickAction:(bool)customClickAction {
dispatch_block_t clickHandler = nil;
if (customClickAction) {
clickHandler = ^{
[self didReceiveClickForAsset:key];
};
}
[self.nativeCustomTemplateAd performClickOnAssetWithKey:key customClickHandler:clickHandler];
}
- (void)didReceiveClickForAsset:(NSString *)key {
if (self.didReceiveClickCallback) {
self.didReceiveClickCallback(self.nativeCustomTemplateClient,
[key cStringUsingEncoding:NSUTF8StringEncoding]);
}
}
- (void)recordImpression {
[self.nativeCustomTemplateAd recordImpression];
}
- (NSArray *)availableAssetKeys {
return [self.nativeCustomTemplateAd availableAssetKeys];
}
@end
// Copyright 2014 Google Inc. All Rights Reserved.
@import Foundation;
@import GoogleMobileAds;
#import "GADUTypes.h"
@interface GADUNativeCustomTemplateAd : NSObject
/// A reference to the Unity native custom template ad client.
@property(nonatomic, assign) GADUTypeNativeCustomTemplateAdClientRef *nativeCustomTemplateClient;
/// A GADNativeCustomTemplateAd which loads native ads.
@property(nonatomic, strong) GADUNativeCustomTemplateAd *nativeCustomTemplateAd;
/// Initializes a GADUNativeCustomTemplateAd.
- (instancetype)initWithAd:(GADNativeCustomTemplateAd *)nativeCustomTemplateAd;
/// The ad clicked callback into Unity.
@property(nonatomic, assign)
GADUNativeCustomTemplateDidReceiveClickCallback didReceiveClickCallback;
/// The custom template ID for the ad.
- (NSString *)templateID;
/// Returns the string corresponding to the specified key.
- (NSString *)stringForKey:(NSString *)key;
/// Returns the native ad image corresponding to the specified key.
- (UIImage *)imageForKey:(NSString *)key;
/// Call when the user clicks on the ad.
- (void)performClickOnAssetWithKey:(NSString *)key withCustomClickAction:(bool)clickAction;
/// Call when the ad is displayed on screen to the user.
- (void)recordImpression;
/// An array of available asset keys.
- (NSArray *)availableAssetKeys;
@end
在您的头文件中,尝试nativeCustomTemplateAd
更改nativeCustomTemplateAd
属性声明:
@property(nonatomic, strong) GADUNativeCustomTemplateAd *nativeCustomTemplateAd;
对此:
@property(nonatomic, strong) GADNativeCustomTemplateAd *nativeCustomTemplateAd;
...您可能只是在班级名称中有一个错字。
您需要定义performClickOnAssetWithKey:customClickHandler:int .h文件。 并在此文件中实现此方法。
GADUNativeCustomTemplateAd.h文件和GADUNativeCustomTemplateAd.m文件中都需要一个@ interface / @ end部分。
在m文件中,它应该在#import之后和@implementation之前,看起来像
@interface GADUNativeCustomTemplateAd()
// private properties of your GADUNativeCustomTemplateAd class
@end
在h文件中,它应类似于:
@interface GADUNativeCustomTemplateAd : UIViewController
{
}
// public properties of your GADUNativeCustomTemplateAd class
@end
如果GADUNativeCustomTemplateAd不是从UIViewController派生的,则应使用它派生的任何类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.