Reputation: 11
I have created simple timetable widget, but when I try to test it in iOS simulator, it says something like
Timetable[4012:108619] Failed to inherit CoreMedia permissions from 3965: (null)
And the widget doesn't show up. Here's my code.
#import "TodayViewController.h"
#import <NotificationCenter/NotificationCenter.h>
@interface TodayViewController () <NCWidgetProviding, UITableViewDataSource, UITableViewDelegate>
@end
@implementation TodayViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TableCell"];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 7;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler {
// Perform any setup necessary in order to update the view.
// If an error is encountered, use NCUpdateResultFailed
// If there's no update required, use NCUpdateResultNoData
// If there's an update, use NCUpdateResultNewData
completionHandler(NCUpdateResultNewData);
}
@end
Upvotes: 1
Views: 838
Reputation: 3380
Swift 4 version:
preferredContentSize = CGSize(width: preferredContentSize.width,
height: CGFloat(objects.count) * 44.0)
Upvotes: 0
Reputation: 70976
That message appears all the time with today widgets and normally doesn't indicate that anything is actually wrong. Unless you're experiencing some kind of problem that you didn't mention, just ignore it.
The reason your widget is not showing up esthete your code doesn't say how much space you need. You need to set self.preferredContentSize
. With table views in a widget you usually do something like:
self.preferredContentSize = CGSizeMake(self.preferredContentSize.width, self.objects.count * 44.0);
Replace self.objects
with whatever array you're using for the table data, and replace 44 with your cell height.
Your code uses 7 rows, which is probably too many. See Issue in Widgets in landscape mode for a discussion of why.
Upvotes: 1