Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
811 views
in Technique[技术] by (71.8m points)

swift - Today Extension Failed to inherit CoreMedia permissions from

I am trying to add a Today Extension in Swift to my Objective-C app. I keep getting this message in my debugger log: Failed to inherit CoreMedia permissions from 3005: (null). The number ex. 3005 is different every time. I am reading from NSUserDefaults from within the widget but I am reading/writing in the app itself. The only code in my TodayViewController is this the following:

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)
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I believe the "Failed to inherit CoreMedia permissions from NNNN" warning is related to App Groups when you are creating an App Extension. Both your containing application and your app extension need to have the App Groups capability turned ON and using the same app group container ID (example: group.com.yourdomain.yourappname). App Groups are used to allow multiple apps access to shared containers and allow additional interprocess communication between apps.

Capabilities should look like this


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...