I know how to get the CFBundleShortVersionString as an NSString:
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
how do I get that as an std::string? I want to assign it to a global extern std::string so I’m assuming it should be a copy.
The assignment operator of
std::stringhas been overloaded and can do what you want. Basically you just need to convert theNSStringto achar[], and then use the assignment operator to load thatchar[]into astd::string.So something like: