zoukankan      html  css  js  c++  java
  • NSString 之谜: <decode: missing data>

      NSString的长度问题 pow(2, 15) 为啥要 -19 

      如下代码产生这个问题:

        NSMutableString *ms = [NSMutableString string];
        for (int i=0; i<pow(2, 15)-19; i++) {
            [ms appendString:@"1"];
        }
        
        NSLog(@"%@  %ld", ms, ms.length);// 32749
        NSLog(@"%ld", ms.length);
        
        [ms appendString:@"1"];
        NSLog(@"%@  %ld", ms, ms.length);// 32750
        NSLog(@"%ld", ms.length);

      输出如下:

      ...1111 32749

      2018-07-25 15:08:27.280985+0800 Demo[30718:219829] 32749

      ...1111 <decode: missing data>

      2018-07-25 15:08:27.280985+0800 Demo[30718:219829] 32750

      

      神一样存在的问题!!!

    时常一个人发呆,看到宁静的天空。
  • 相关阅读:
    Python下载安装
    批量修改样式及全选反选
    小99
    练习题
    练习
    对象、函数
    操作document对象练习
    练习题
    0513-2
    0513-1
  • 原文地址:https://www.cnblogs.com/pinweyshg/p/9366139.html
Copyright © 2011-2022 走看看