Gom*_*rek 7 swift ios13 xcode11
我尝试在iOS13 Beta上测试应用。当我在欢迎屏幕上点击按钮以选择另一个屏幕时,应用程序冻结,然后终止。当我在Xcode 11中进行调试时,我在控制台日志中看到以下警告行
[framework] CoreUI: RunTimeThemeRefForBundleIdentifierAndName() couldn't find Assets.car in bundle with identifier: '(null)'
[framework] CoreUI: RunTimeThemeRefForBundleIdentifierAndName() couldn't find Assets.car in bundle with identifier: '(null)'
Run Code Online (Sandbox Code Playgroud)
然后几秒钟后,应用程序终止并显示日志条目:
Message from debugger: Terminated due to memory issue
Run Code Online (Sandbox Code Playgroud)
在iOS 12上没有这样的问题。我用几个资产文件创建了简单的测试应用程序,并在单击按钮时进行筛选工作正常。我也将目标版本更改为iOS 13,更改了包标识符,进行了清理和重建-但问题并没有消失
我发现这个问题与
CoreUI:RunTimeThemeRefForBundleIdentifierAndName() 无法在标识符为“(null)”的捆绑包中找到 Assets.car
在目标屏幕上使用了自定义 UILabel。应用程序冻结和内存问题的根本原因是其方法之间的可重入循环
override var text: String? {
didSet {
guard let text = text else { return }
let textRange = NSMakeRange(0, text.count)
// Kern attribute needed to do letter spacing over text
let attributedText = NSMutableAttributedString(string: text)
attributedText.addAttribute(NSAttributedStringKey.kern , value: 2.0, range: textRange)
// Add other attributes if needed
self.attributedText = attributedText
}
}
Run Code Online (Sandbox Code Playgroud)
和
override public func layoutSubviews() {
super.layoutSubviews()
if let text = self.text {
self.text = text.uppercased()
}
}
Run Code Online (Sandbox Code Playgroud)
attributedText当字段更改时,新的 SDK 版本可能会调用 layoutSubviews()
| 归档时间: |
|
| 查看次数: |
4456 次 |
| 最近记录: |