1.How do I convert a NSString into a std::string?
NSString *foo = @"Foo";
std::string *bar = new std::string([foo UTF8String]);
2.How to convert std::string to NSString?
NSString *errorMessage = [NSString stringWithCString:REALM.c_str()
encoding:[NSString defaultCStringEncoding]];
转自:
http://stackoverflow.com/questions/3552195/how-to-convert-stdstring-to-nsstring
http://stackoverflow.com/questions/8001677/how-do-i-convert-a-nsstring-into-a-stdstring