Я добавляю в info.plist свои строки с тегом NSUserActivityTypes.
Я добавляю этот фрагмент кода в метод viewDidload экрана:
NSUserActivity * userActivityTag = [[NSUserActivityalloc] initWithActivityType: kVoucher];
if(@available(iOS 12.0, *)) {
[userActivityTag setEligibleForPrediction:YES];
userActivityTag.suggestedInvocationPhrase = [NSString stringWithFormat:@"Let's Voucher this"];
}
[userActivityTag setEligibleForSearch:YES];
[userActivityTag setRequiredUserInfoKeys:nil];
userActivityTag.title = [NSString stringWithFormat:@"Voucher"];
userActivityTag.userInfo = @{
@"value":@"key"
};
UIImage *logo = [UIImage imageNamed:@"someImage"];
NSData *logoNSData = UIImageJPEGRepresentation(logo, 1.0f);
CSSearchableItemAttributeSet *attributes = [[CSSearchableItemAttributeSet alloc] initWithItemContentType: (NSString *)kUTTypeItem];
attributes.title = @"title";
attributes.keywords = @[@"implement", @"something", @"lol"];
attributes.contentDescription = @"Subtitle";
attributes.thumbnailData = logoNSData;
attributes.domainIdentifier = @"ownID";
userActivityTag.contentAttributeSet = attributes;
[userActivityTag becomeCurrent];
После этого я перехожу на этот экран и ставлю точку останова, чтобы проверить, был ли выполнен код.Я включаю обе опции в «Настройки» -> «Разработчик» -> «Показать последние ярлыки» и «Показать пожертвования» на экране блокировки.
На моем AppDelegate у меня было следующее:
if([userActivity.activityType isEqualToString:kVoucher]) {
// Restore state for userActivity and userINFO
}
Итак, вопрос такой:Почему я не вижу своего ярлыка на экране блокировки?
Любая помощь, пожалуйста!