2014-05-07 32 views
3

的格式的int64_t符我無法找到正確的格式說明符int64_t什麼是NSString的

int64_t var; 

[NSString stringWithFormat:@"value is: %?? ",var]; 
+0

http://stackoverflow.com/questions/13604137/definition-of -int64 -t and http://stackoverflow.com/questions/2985008/how-should-i-declare-a-long-in-objective-c-is-nsinteger-expo – iPatel

+0

我看着這個答案,但我沒有'特別是當涉及到32位64位平臺兼容性時,我們可以找到解決方案。 –

+4

@NicolasManzini:你可以直接使用這個問題的第一個答案:'[NSString stringWithFormat:@「value is:%」PRId64「」,var]'適用於所有平臺。 –

回答

5

嘗試:

int64_t var;  
[NSString stringWithFormat:@"value is: %lld",var]; 
+1

或者將數字作爲一個對象裝箱是相當不錯的,即'[NSString stringWithFormat:@「值是:%@」,@(var)]' –

相關問題