Ios 使用未声明的标识符:ASIdentifierManager

Ios 使用未声明的标识符:ASIdentifierManager,ios,ios6,admob,undeclared-identifier,Ios,Ios6,Admob,Undeclared Identifier,我使用以下代码显示admob测试应用程序使用的唯一标识符 这是我的ApplicationIDFinishLaunching // Print IDFA (from AdSupport Framework) for iOS 6 and UDID for iOS < 6. if (NSClassFromString(@"ASIdentifierManager")) { NSLog(@"GoogleAdMobAdsSDK ID for testing: %@" , [

我使用以下代码显示admob测试应用程序使用的唯一标识符

这是我的ApplicationIDFinishLaunching

// Print IDFA (from AdSupport Framework) for iOS 6 and UDID for iOS < 6.
if (NSClassFromString(@"ASIdentifierManager")) {
    NSLog(@"GoogleAdMobAdsSDK ID for testing: %@" ,
          [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]);
} else {
    NSLog(@"GoogleAdMobAdsSDK ID for testing: %@" ,
          [[UIDevice currentDevice] uniqueIdentifier]);
}
//打印iOS 6的IDFA(来自AdSupport Framework)和iOS<6的UDID。
if(NSClassFromString(@“ASIdentifierManager”)){
NSLog(@“用于测试的GoogleedMobaDSDK ID:%@”),

[[ASIdentifierManager共享管理器]广告标识器]UUIString]); }否则{ NSLog(@“用于测试的GoogleedMobaDSDK ID:%@”), [[UIDevice currentDevice]唯一标识符]; }
生成“使用未声明的标识符:ASIdentifierManager”时出错

我链接了AdSupport框架,可以访问标识符管理器声明的文件,但它仍然无法识别


我已经清理了构建文件夹,重新启动了xCode,结果相同。

您从框架中导入了头文件吗

#import <AdSupport/ASIdentifierManager.h>
#导入

谢谢您的回答!如果是框架,则添加起始路径。修复我的错误的示例是:

#import "CoreMotion/CMMotionActivityManager.h"
我不正确,因为我只添加了.h文件

#import "CMMotionActivityManger.h"  ---  This was incorrect and generated an error.

您具体在哪一行获得错误?[[ASIdentifierManager sharedManager]advertisingIdentifier]UUIString];您是否从框架中导入了头文件?#导入否我没有导入头文件,因为我假设它们位于“链接二进制文件与库”中,我不需要导入头文件?请提交解决问题的答案