我正在尝试将 Swift 中的 Today Extension 添加到我的 Objective-C 应用程序中。我在调试器日志中不断收到此消息:Failed to inherit CoreMedia permissions from 3005: (null)
. 号码前。3005每次都不一样。我正在从小部件中读取 NSUserDefaults,但我正在应用程序本身中读取/写入。我的 TodayViewController 中唯一的代码如下:
override func viewDidLoad() {
super.viewDidLoad()
let formatter = NSNumberFormatter()
formatter.numberStyle = .CurrencyStyle
totalLabel.text = formatter.stringFromNumber(0)
coinsLabel.text = formatter.stringFromNumber(0)
formatter.maximumFractionDigits = 0
billsLabel.text = formatter.stringFromNumber(0)
}
func widgetMarginInsetsForProposedMarginInsets(defaultMarginInsets: UIEdgeInsets) -> UIEdgeInsets {
return UIEdgeInsetsMake(8.0, 16.0, 8.0, 16.0)
}
func widgetPerformUpdateWithCompletionHandler(completionHandler: ((NCUpdateResult) -> Void)!) {
// Perform any setup necessary in order to update the view.
// If an error is encountered, use NCUpdateResult.Failed
// If there's no update required, use NCUpdateResult.NoData
// If there's an update, use NCUpdateResult.NewData
completionHandler(NCUpdateResult.NewData)
}