Convert QString to NSString*
-
Hi all,
I'm working on an iOS app. I need to convert a QString to a NSString* but I can't figure out how it works. The following code produces a NSException:
@try
{
QString qs = "test";
NSString* nss = qs.toNSString();
NSLog(@"qs to ns: %@", [NSString nss]);
}
@catch (NSException *theException)
{
NSLog(@"An exception occurred: %@", theException.name);
NSLog(@"Here are some details: %@", theException.reason);
}log output:
2016-07-25 13:58:13.676 MyApp[3832:1414942] +[NSString nss]: unrecognized selector sent to class 0x3b5b42dc
2016-07-25 13:58:13.677 MyApp[3832:1414942] An exception occurred: NSInvalidArgumentException
2016-07-25 13:58:13.677 MyApp[3832:1414942] Here are some details: +[NSString nss]: unrecognized selector sent to class 0x3b5b42dcWhat do I miss?
Thank you in advance.
-
Hi all,
I'm working on an iOS app. I need to convert a QString to a NSString* but I can't figure out how it works. The following code produces a NSException:
@try
{
QString qs = "test";
NSString* nss = qs.toNSString();
NSLog(@"qs to ns: %@", [NSString nss]);
}
@catch (NSException *theException)
{
NSLog(@"An exception occurred: %@", theException.name);
NSLog(@"Here are some details: %@", theException.reason);
}log output:
2016-07-25 13:58:13.676 MyApp[3832:1414942] +[NSString nss]: unrecognized selector sent to class 0x3b5b42dc
2016-07-25 13:58:13.677 MyApp[3832:1414942] An exception occurred: NSInvalidArgumentException
2016-07-25 13:58:13.677 MyApp[3832:1414942] Here are some details: +[NSString nss]: unrecognized selector sent to class 0x3b5b42dcWhat do I miss?
Thank you in advance.
-
Hi,
If you want to log
nss
why not useNSLog(@"qs to ns: %@", nss);
?