【问题标题】:XCode Version 6.1 (6A1052d) update causes error: 'dictionaryWithCapacity' has been explicitly marked unavailable here (Foundation.NSMutableDictionary)XCode 版本 6.1 (6A1052d) 更新导致错误:“dictionaryWithCapacity”已在此处明确标记为不可用(Foundation.NSMutableDictionary)
【发布时间】:2014-11-28 13:24:13
【问题描述】:

XCode 自动更新,重启后发现有很多错误。

这是导致相关错误的代码:

    let navBarTextAttributes = NSMutableDictionary.dictionaryWithCapacity(1)
    navBarTextAttributes.setObject(UIColor.whiteColor(), forKey: NSForegroundColorAttributeName)
    navigationController?.navigationBar.titleTextAttributes = navBarTextAttributes
}

我不知道如何解决这个问题。

谁能给我一些见解?

感谢您的宝贵时间。

【问题讨论】:

    标签: ios xcode cocoa-touch swift nsmutabledictionary


    【解决方案1】:

    Objective-C 类(工厂)方法现在作为自定义初始化器导入 Swift:

    let navBarTextAttributes = NSMutableDictionary(capacity: 1)
    

    【讨论】:

      猜你喜欢
      • 2015-08-29
      • 2021-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多