我发现了一个奇怪的行为,当我显示JSON对象在字典中解析的结果,然后打印在alertView上(在Xcode 5.1.1上,在iOS 64位模拟器上为iOS 7.1编译)。出于同样的inputData:
[[UIAlertView alloc]initWithTitle:@"something" message:[[[NSString stringWithFormat:@"json:%@",[inputData dictionaryRepresentation]] stringByReplacingOccurrencesOfString:@" "withString:@""]substringToIndex:7035] delegate:self cancelButtonTitle:@"ok" otherButtonTitles: nil];
打印正确,但如果我说“substringToIndex:7036”,仅显示空白......没有“stringByReplacingOccurrencesOfString:”法的限制远远超出:
[[UIAlertView alloc]initWithTitle:@"something" message:[[NSString stringWithFormat:@"json:%@",[inputData dictionaryRepresentation]] substringToIndex:13768] delegate:self cancelButtonTitle:@"ok" otherButtonTitles: nil];
正确打印,而不是“substringToIndex:13769”不打印...我意识到这不是一个最大长度的问题,但在JSON对象内的特殊字符
你想要显示的文本就像一个段落? –
使你自己的警报视图更容易 – amar