2012-09-24 45 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];將解決你的問題。