将cbuuid放入nsdata?

时间:2014-08-07 17:27:50

标签: ios nsdata

我试图将一个cbuuid字符串放入nsdata,但我找不到合适的方法。以下是我尝试过的一些事情:

//NSData* UUIDsKey_data = [[NSData alloc] initWithType:[CBUUID UUIDWithString: @GENERIC_SYSTEM_DEVICE_SERVICES_UUID_iOS ]]];

    //NSData* UUIDsKey_data = [[NSData alloc] initWithData:[CBUUID UUIDWithString: @GENERIC_SYSTEM_DEVICE_SERVICES_UUID_iOS ]];

    //NSData* UUIDsKey_data = [[NSData alloc] initWithContentsOfFile:[CBUUID UUIDWithString: @GENERIC_SYSTEM_DEVICE_SERVICES_UUID_iOS ]];

   // NSData* UUIDsKey_data = [NSKeyedArchiver archivedDataWithRootObject:[CBUUID UUIDWithString: @GENERIC_SYSTEM_DEVICE_SERVICES_UUID_iOS ]];

    //NSData* UUIDsKey_data = [[NSData alloc] initWithBase64Encoding:[CBUUID UUIDWithString: @GENERIC_SYSTEM_DEVICE_SERVICES_UUID_iOS ]];

我该怎么转换呢?请帮忙!

1 个答案:

答案 0 :(得分:1)

怎么样:

CBUUID *guid = [CBUUID UUIDWithString:@GENERIC_SYSTEM_DEVICE_SERVICES_UUID_iOS];
NSData * UUIDsKey_data = guid.data;