开发者

NSLocalizedString random problem

开发者 https://www.devze.com 2023-03-09 03:11 出处:网络
i\'ve a strange problem with following code: NSString *string = NSLocalizedString(\"hello\",nil); actived by tapping a button. If i use a simple string all ok, if i use the localized string after 1

i've a strange problem with following code:

NSString *string = NSLocalizedString("hello",nil);

actived by tapping a button. If i use a simple string all ok, if i use the localized string after 1-2 tap on the button the app crash without any error, i really don't unde开发者_开发问答rstand why, can you help me? Thanks.


It's easy to miss: you should use @"hello", not a "hello". NSString* constant must be defined with preceding @.


This works:

NSString *string = NSLocalizedString(@"hello",@"");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号