How to find Crash Log of iOS Simulator

Suppose you do not have Xcode running, but want to view crash logs of your simulator, you can do that easily by visiting

~/Library/Logs/DiagnosticReports/

Here all crash log files can be found with .crash extension.

Note: you need to launch your app without Xcode in order to have the log updated.

Sources

Crash logs generated by iPhone Simulator? – Stack Overflow. http://stackoverflow.com/questions/1864479/crash-logs-generated-by-iphone-simulator

How to parse JSON Array in Swift using AFNetworking

Here I will describe how to parse a JSON array in Swift using AFNetworking for the request. Suppose your network request returns a JSON like

[
{'prop':'Property1'},
{'prop':'Property2'},
...
]

Here’s the code you want to use

// items
let manager = AFHTTPRequestOperationManager()
        
manager.GET("", parameters: nil,
     success: {
         (operation: AFHTTPRequestOperation!,
         responseObject: AnyObject!) in
         if let jsonArray = responseObject as? NSArray {
                    
              for propInfo in jsonArray {
                 let propObject = propInfo as! NSDictionary
                 let prop:String = propObject["prop"] as! String
                 print("property extracted: \(prop)")                
              }
          }             
      },
      failure: {
          (operation: AFHTTPRequestOperation!, error: NSError!) in
          print("Error: " + error.localizedDescription)
                
      }
)