gpt4 book ai didi

加载时 iOS 8 Today 小部件不显示

转载 作者:行者123 更新时间:2023-11-29 12:28:55 26 4
gpt4 key购买 nike

我已经创建了简单的时间表小部件,但是当我尝试在 iOS 模拟器中测试它时,它会说类似

Timetable[4012:108619] Failed to inherit CoreMedia permissions from 3965: (null)

而且小部件没有显示。这是我的代码。

#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

最佳答案

该消息一直与今天的小部件一起出现,通常并不表示实际上有任何错误。除非您遇到某种您没有提及的问题,否则请忽略它。

您的小部件未显示的原因是您的代码没有说明您需要多少空间。您需要设置 self.preferredContentSize。使用小部件中的 TableView ,您通常会执行以下操作:

self.preferredContentSize = CGSizeMake(self.preferredContentSize.width, self.objects.count * 44.0);

self.objects 替换为您用于表格数据的任何数组,并将 44 替换为您的单元格高度。

您的代码使用 7 行,这可能太多了。参见 Issue in Widgets in landscape mode讨论原因。

关于加载时 iOS 8 Today 小部件不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28332175/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com