【问题标题】:Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set."错误域 = NSCocoaErrorDomain 代码 = 3840 “JSON 文本没有以数组或对象开头,并且允许未设置片段的选项。”
【发布时间】:2016-06-04 14:06:48
【问题描述】:

错误类型:错误域=NSCocoaErrorDomain 代码=3840“JSON 文本没有以数组或对象开头,并且允许未设置片段的选项。”.UserInfo={NSDebugDescription=JSON 文本没有以数组或对象开头,并且选项允许未设置的片段。

场景:Bonjour 服务器能够成功地将 JSON 数据发送到客户端。但我偶尔会看到这些错误:Error Domain=NSCocoaErrorDomain Code=3840

谁能建议如何克服这个问题?

【问题讨论】:

    标签: ios json bonjour


    【解决方案1】:

    设置

    AFJSONResponseSerializer *responseSerializer = [AFJSONResponseSerializer serializerWithReadingOptions:NSJSONReadingAllowFragments];
    

    或参考此Link

    【讨论】:

    • 嘿@JigneshP 我从 Bonjour Server(这里是 Apple Tv)而不是从 Http 获取数据。你能相应地给我建议吗?
    猜你喜欢
    • 1970-01-01
    • 2014-01-06
    • 1970-01-01
    • 2018-05-21
    • 1970-01-01
    • 2016-03-01
    • 1970-01-01
    相关资源
    最近更新 更多