2012-09-24 43 views
1

无符号短*在我的代码我在与定义单字符格式的一些字符串像下面格式描述符,在IOS 6

unichar sourceString[100]; 

后我将值分配给sourceString,我需要把它放到适当一个NSString格式描述符。

以前在IOS 5中,我使用%S,它工作得很好。代码如下所示

NSString * targetString = [NSString stringWithFormat:@"%S",sourceString]; 

但经过我升级SDK到IOS 6.0,警告想出了相同的代码:

**Format specifies type 'const unsigned short *' but the argument has type 'unichar *' (aka 'unsigned short *')** 

我的应用程序仍然有效,但也有数百个警告的代码时编译,这真的很烦人。

我想知道什么是正确的格式描述符,我将在这种情况下使用?

谢谢!

回答

2

使用const unichar sourceString[100];将解决你的问题。