• _NSInlineData objectForKeyedSubscript:


    最近总是遇到这个错误:reason: '-[_NSInlineData objectForKeyedSubscript:]: unrecognized selector sent to instance 0x7fa2049bf220'

    两个解决方法:

    1>用 AFNetworking 进行数据处理的时候,记得加上------  

    manager.responseSerializer = [AFJSONResponseSerializer serializer];

    就可以了。

    2>如果此时打印的 responseObject 还是一串你看不懂字符,想让其转换成可读懂的数据,那么,就在数据解析成功的方法里加上这个-----  

    NSString *result = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];

            NSDictionary * dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];

            NSLog(@"result1 = %@", result);

            NSLog(@"dic = %@",dic);

    综上所述,是因为后台设置的JSon 字符串和AFNetworking 解析出来的不一致,虽说 AFNetworking 本身自带 JSon Text 解析功能,但是保不齐存在不给力的后台队友呢?不影响开发进度的一种方法而已。

  • 相关阅读:
    计算机组成原理学习总纲图
    USE RED
    既有的问题如何解决
    字符串极值题解
    扩展 KMP
    KMP
    FHQ-Treap
    STL
    iOS内存管理理论知识过一遍
    iOS中Block理论知识过一遍
  • 原文地址:https://www.cnblogs.com/sandyzhang/p/5844699.html
Copyright © 2020-2023  润新知