0

当我尝试设置它时,我不断收到链接器错误。我在我的应用程序委托中使用它来配置所有内容

- (void) configureBump {
[BumpClient configureWithAPIKey:@"your_api_key" andUserID:[[UIDevice currentDevice] name]];

[[BumpClient sharedClient] setMatchBlock:^(BumpChannelID channel) { 
    NSLog(@"Matched with user: %@", [[BumpClient sharedClient] userIDForChannel:channel]); 
    [[BumpClient sharedClient] confirmMatch:YES onChannel:channel];
}];

[[BumpClient sharedClient] setChannelConfirmedBlock:^(BumpChannelID channel) {
    NSLog(@"Channel with %@ confirmed.", [[BumpClient sharedClient] userIDForChannel:channel]);
    [[BumpClient sharedClient] sendData:[[NSString stringWithFormat:@"Hello, world!"] dataUsingEncoding:NSUTF8StringEncoding]
                              toChannel:channel];
}];

[[BumpClient sharedClient] setDataReceivedBlock:^(BumpChannelID channel, NSData *data) {
    NSLog(@"Data received from %@: %@", 
          [[BumpClient sharedClient] userIDForChannel:channel], 
          [NSString stringWithCString:[data bytes] encoding:NSUTF8StringEncoding]);
}];

[[BumpClient sharedClient] setConnectionStateChangedBlock:^(BOOL connected) {
    if (connected) {
        NSLog(@"Bump connected...");
    } else {
        NSLog(@"Bump disconnected...");
    }
}];

[[BumpClient sharedClient] setBumpEventBlock:^(bump_event event) {
    switch(event) {
        case BUMP_EVENT_BUMP:
            NSLog(@"Bump detected.");
            break;
        case BUMP_EVENT_NO_MATCH:
            NSLog(@"No match.");
            break;
    }
}];
}

我得到的错误如下:

Undefined symbols for architecture i386:
"_CFHostCreateWithName", referenced from:
  -[BumpClient ipStringForHost] in libBump.a(BumpClient-4A2ADD525826BE6B.o)
"_CFHostStartInfoResolution", referenced from:
  -[BumpClient ipStringForHost] in libBump.a(BumpClient-4A2ADD525826BE6B.o)
"_CFHostGetAddressing", referenced from:
  -[BumpClient ipStringForHost] in libBump.a(BumpClient-4A2ADD525826BE6B.o)
"_CFHostGetNames", referenced from:
  -[BumpClient ipStringForHost] in libBump.a(BumpClient-4A2ADD525826BE6B.o)
"_OBJC_CLASS_$_CLLocationManager", referenced from:
  objc-class-ref in libBump.a(BumpClient-4A2ADD525826BE6B.o)
"_kCLLocationAccuracyBest", referenced from:
  -[BumpClient init] in libBump.a(BumpClient-4A2ADD525826BE6B.o)
"_AudioServicesCreateSystemSoundID", referenced from:
  -[BumpDetector init] in libBump.a(BumpDetector.o)
"_AudioServicesPlaySystemSound", referenced from:
  -[BumpDetector init] in libBump.a(BumpDetector.o)
  -[BumpDetector playBumpSound] in libBump.a(BumpDetector.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我有 libBump.a 和 BumpClient.H 并检查正在链接的框架,包括 libBump

4

1 回答 1

1

看起来您没有链接到 libBump.a 所依赖的框架。例如。_CFHostCreateWithName 来自CoreServices框架,_AudioServicesPlaySystemSound 来自AudioToolbox框架。

于 2012-06-27T17:00:07.130 回答