iOS _OBJC_CLASS _ $ _ ASIdentifierManage引自:ViewController.o中的objc-class-ref

Cyp*_*yph 11 linker-errors ios

我试图在iOS中启动WebView并将IDFA作为GET请求的一部分进行传输,但是当我尝试构建它失败时,我收到以下错误:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_ASIdentifierManager", referenced from:
   objc-class-ref in ViewController.o
   ld: symbol(s) not found for architecture i386
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

这是我的代码.知道我在这里做错了什么,我有点卡住了

    #import "ViewController.h"
    #import "AdSupport/ASIdentifierManager.h"

    @interface ViewController ()
    @end

    @implementation ViewController
    @synthesize webView;



    - (void)viewDidLoad
    {
        NSString *idfaString = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];

    webView.backgroundColor = [UIColor blueColor];
    NSURL *url = [NSURL URLWithString:@"http://example.com/"];
    NSString *param = [url.path stringByAppendingString: idfaString];
    NSURL *send = [[NSURL alloc] initWithString:param];
    NSURLRequest *req = [NSURLRequest requestWithURL:send];

    [webView loadRequest:req];


    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

    - (void)didReceiveMemoryWarning
   {
       [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
Run Code Online (Sandbox Code Playgroud)

Enr*_*tyo 27

如果你和我一样愚蠢,别忘了添加AdSupport.framework你的项目.


rma*_*ddy 21

确保ASIdentifierManager.m在"目标成员资格"下检查项目的目标.

  • 谢谢@rmaddy.这是正确的方向.我没有在"链接的框架和库"下列出的AdSupport.framework,可以在Tragets - > General部分的Xcode中修改. (6认同)