Doarchive

converter Data to String 본문

Mobile/iOS

converter Data to String

오순발닦개 2020. 12. 15. 09:57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
uint8_t *receivecData = (uint8_t*)[data bytes];
 
    NSString *receivecStr;
 
    
 
    const unsigned char *dbytes = [data bytes];
 
        NSMutableString *hexStr =
 
           [NSMutableString stringWithCapacity:[data length]*2];
 
        int i;
 
        for (i = 0; i < [data length]; i++) {
 
            [hexStr appendFormat:@"%02x ", dbytes[i]];
 
        }
 
    receivecStr = [NSString stringWithString: hexStr];
cs

 

728x90