为什么这种字符串格式会导致 NSDate 为零?

Why does this string format result in a nil NSDate?

为什么 realDate 以零值结束?

    let dateFormatter = NSDateFormatter()
    dateFormatter.dateFormat = "yyyy-MM-dd"
    let testString = "2015-07-01 05:00:00 +0000"
    let realDate = dateFormatter.dateFromString(testString)

因为日期格式不匹配。对于 realDate,您将采用下一种格式:

dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss Z"