ASIHTTPRequest build / link error

2019-02-28 15:08发布

问题:

- (void)getFacebookProfile {
    NSString *urlString = [NSString stringWithFormat:@"https://graph.facebook.com/me?access_token=%@", [_accessToken stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    NSURL *url = [NSURL URLWithString:urlString];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setDidFinishSelector:@selector(getFacebookProfileFinished:)];

    [request setDelegate:self];
    [request startAsynchronous];
}

The above method (from www.raywenderlich.com) fails with the following error:

Undefined symbols:

"_OBJC_CLASS_$_ASIHTTPRequest", referenced from: objc-class-ref-to-ASIHTTPRequest in FBFunViewController.o ld: symbol(s) not found collect2: ld returned 1 exit status

What is the problem? Can someone help?

回答1:

Check the instructions here:

http://allseeing-i.com/ASIHTTPRequest/Setup-instructions

It seems likely one of the two steps listed has been skipped or not done correctly. Is it possible that you've not added ASIHTTPRequest.m to your project? or it's not been included in the target you're building?