diff --git a/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m b/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m index 31f066c..a8f8da3 100644 --- a/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m +++ b/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m @@ -308,6 +308,12 @@ static NSString * const KBAISelectedPersonaIdKey = @"KBAISelectedPersonaId"; if (weakSelf.currentPage == 1) { [weakSelf.collectionView reloadData]; [weakSelf preloadDataForIndexes:@[@0, @1, @2]]; + // 首次加载完成后,主动保存默认 persona 到 AppGroup, + // 避免用户未滑动时键盘扩展拿不到数据 + if (weakSelf.personas.count > 0) { + NSInteger index = MIN(MAX(weakSelf.currentIndex, 0), weakSelf.personas.count - 1); + [weakSelf saveSelectedPersonaToAppGroup:weakSelf.personas[index]]; + } } else if (pageModel.records.count > 0) { NSInteger newCount = weakSelf.personas.count; NSMutableArray *indexPaths = [NSMutableArray array];