1

我正在尝试使用 XCode 5 中内置的一些库来链接 XCode 4 中的某个应用程序。该库引用了 iOS7 SDK 中定义的常量,但 iOS6 SDK 中没有。

所以我收到了这个错误:

架构 armv7s 的未定义符号:“_CBPeripheralManagerRestoredStateServicesKey”,引用自:

有没有办法保持与 XCode 4 和 SDK for iOS6 的向后兼容性?

4

1 回答 1

0
+ (NSString *)getCoreBluetoothConstantByName:(NSString *)name
    {
    void *libHandle = dlopen("/System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth", RTLD_LOCAL);

if (libHandle != NULL)
    {
    NSString **key = dlsym(libHandle, [name cStringUsingEncoding:NSASCIIStringEncoding]);

    dlclose(libHandle);

    return [[*key copy] autorelease];
    }

return nil;
}
于 2013-07-31T11:32:38.587 回答