Question

I'm trying to use some library built in XCode 5 to link in some app in XCode 4. That library has references to constants defined in iOS7 SDK, but not in iOS6 SDK.

So I'm getting this error:

Undefined symbols for architecture armv7s: "_CBPeripheralManagerRestoredStateServicesKey", referenced from:

Is there any way to preserve backward compatibility with XCode 4 and SDK for iOS6?

Was it helpful?

Solution

+ (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;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top