Ios 升级Xcode 7后加载本地json文件时出错

Ios 升级Xcode 7后加载本地json文件时出错,ios,json,xcode,Ios,Json,Xcode,我有一个json文件,它位于Xcode内部。在升级Xcode 7之前,我一直在向UITableView显示信息。你能告诉我如何解决这个问题吗 下面是json文件的示例内容 主要原因是因为NSAppTransportsecurity,所以您需要在xcode7中将以下内容添加到您的项目中。在Info.plist中添加NSAppTransportSecurity As Dictionary&child AsNSAllowsArbitraryLoads As Boolean值为YES您好,我尝试了您

我有一个json文件,它位于Xcode内部。在升级Xcode 7之前,我一直在向UITableView显示信息。你能告诉我如何解决这个问题吗

下面是json文件的示例内容


主要原因是因为NSAppTransportsecurity,所以您需要在xcode7中将以下内容添加到您的项目中。在Info.plist中添加
NSAppTransportSecurity As Dictionary
&child As
NSAllowsArbitraryLoads As Boolean
值为YES

您好,我尝试了您的解决方案,但没有机会,下面是错误详细信息;致命错误:“尝试!”表达式意外引发错误:error Domain=nscocaerordomain Code=3840“字符314671周围的数组格式错误”。UserInfo={NSDebugDescription=字符314671周围的数组格式错误。}:file/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.59/src/swift/stdlib/public/core/ErrorType.swift,第50行错误行;让json:[任何对象]!=(试试!NSJSONSerialization.JSONObjectWithData(result!,选项:NSJSONReadingOptions.MutableContainers))作为![AnyObject]我该怎么办?你在你的项目中遵循了try and catch吗??
[
{
“title”: “School”,
“name”: [“Kyle”, “Joy”, “Melissa”],
},
{
“title”: “Job”,
“name”: [“Michael”, “Eric”, “Nichol”]
}

]
lazy var stories : [AnyObject] = {
        let path = NSBundle.mainBundle().pathForResource("Stories", ofType: "json")
        let data = NSString(contentsOfFile: path!, encoding: NSUTF8StringEncoding, error: nil)

        let result = data?.dataUsingEncoding(NSUTF8StringEncoding)
        let json : [AnyObject]! = NSJSONSerialization.JSONObjectWithData(result!, options: NSJSONReadingOptions.MutableContainers, error: nil) as! [AnyObject]

        return json
    }()