我试图将常量char *转换为NSString *,然后将其转换回来。它的工作原理,但我得到:将const char *转换为NSString *并转换回来_NSAutoreleaseNoPool()
__NSAutoreleaseNoPool(): Object 0x100550a40 of class NSCFArray autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x100551730 of class NSCFString autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x100551f10 of class NSCFData autoreleased with no pool in place - just leaking
的代码是:
const char* convert = "hello remove this: *";
NSString *input = [[NSString alloc] initWithUTF8String:convert];// convert
//remove * FROM THE STRING
NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"*"];
// REPLACE * WITH NOTHING
input = [[input componentsSeparatedByCharactersInSet: doNotWant] componentsJoinedByString: @""];
// CONVERT BACK
const char *converted_back = [input UTF8String];
我迷路了,请帮我出。
显示你所有的代码,我想我知道问题是什么,但我需要先检查你的整个代码。 – 2012-04-23 16:07:20