Search code examples
iosnsdata

putting cbuuid into nsdata?


I am trying to put a cbuuid string into an nsdata, but i can't find the right method. Here are some of the things I have tried:

//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 ]];

how do I convert this? Please help!


Solution

  • What about:

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