我试图将Swift中的Today扩展添加到我的Objective-C应用程序中。我在调试器日志中不断收到此消息:Failed to inherit CoreMedia permissions from 3005: (null)
。编号ex。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)
}