当我尝试设置时,我不断收到链接器错误。我在我的app委托中使用它来配置所有内容
- (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
答案 0 :(得分:1)
看起来你没有链接到libBump.a所依赖的框架。例如。 _CFHostCreateWithName来自CoreServices
框架,_AudioServicesPlaySystemSound来自AudioToolbox
框架。