我试图通过使用核心数据来获取数据,但是发生了一些错误。这是我的数据模型的图片: 和Feed.h的代码
$name = $_POST['name'];
$statement = $db->prepare("SELECT * FROM authors WHERE name = ?");
$statement->execute(array($name));
$author_id = $statement->fetch()["id"];
$statement = $db->prepare("SELECT * FROM quotes WHERE author_id = ?");
$statement->execute(array($author_id));
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
$quote = $row['quote'];
}
首先,我确定我在FeedList中获取了Feed表的数据TableViewController。当我点击表的一行时,它应该推送到FeedItem TableViewController,其中包含FeedItem的数据。这里有'是第一控制器的代码:
@interface Feed (CoreDataProperties)
@property (nullable, nonatomic, retain) NSString *rssURL;
@property (nullable, nonatomic, retain) NSString *summary;
@property (nullable, nonatomic, retain) NSString *title;
@property (nullable, nonatomic, retain) NSSet *feedItems;
@end
我尝试在FeedItemsViewController中获取FeedItem
- (void)cellDidPress:(NSIndexPath *)atIndexPath{
if (atIndexPath.row < self.allFeeds.count) {
RSFeedItemsViewController *itemsVC = [[RSFeedItemsViewController alloc] init];
itemsVC.feed = self.allFeeds[atIndexPath.row];
[self.navigationController pushViewController:itemsVC animated:YES];
}
}
我得到以下例外:
NSMutableArray *allItems = [[[self.feed feedItems] allObjects] mutableCopy];
我应该执行另一个获取请求来获取FeedItem的数据吗? 任何帮助表示赞赏。
由于