_BSMachError while running Stanford's CS193p Smashtag app

后端 未结 5 2162
北恋
北恋 2021-02-14 01:06

I downloaded the Smasthag demo app from course\'s site. Project builds fine (after small changes in Twitter, TwitterRequest etc. classes, because I use the latest Xcode 7b4) and

5条回答
  •  滥情空心
    2021-02-14 01:46

    To fix this issue you should set locale to en_US.

    Change the private extension asTwitterDate in Tweet.swift to the following to fix issue on non en_US devices.

    ...
    private extension String {
      var asTwitterDate: NSDate? {
        get {
            let dateFormatter = NSDateFormatter()
            dateFormatter.dateFormat = "EEE MMM dd HH:mm:ss Z yyyy"
            dateFormatter.locale = NSLocale(localeIdentifier: "en_US")
            let createdAt = dateFormatter.dateFromString(self)
            return createdAt
        }
      }
    }
    

    After this your application should load and show all data correctly.

提交回复
热议问题