문제

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?

도움이 되었습니까?

해결책

+ (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;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top