I have some data for my app authorisation like {0x7c, 0x1e, ...} and I need to get it in Objective-C file like:
const unsigned char ApplicationKey[] = {0x7c, 0x1e, ...};
Is there any way to get this const from plist-file?
I need this because according to this answer this answer this is the thing in NuanceHeader.m And I would like just store my AppKey in plist, neither in code.
Fundamentally a plist can contain numeric values in the form of NSNumber
instances. You can create an unsigned char
from those fairly easily:
NSString* pathToPlist = // Determine path to plist
NSArray* plist = [NSArray arrayWithContentsOfFile:pathToPlist];
unsigned char applicationKey[plist.count];
[plist enumerateObjectsUsingBlock:^(NSNumber* number, NSUInteger index, BOOL* stop) {
applicationKey[index] = [number unsignedCharValue];
}];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.