iOS 应用程序:保留旧的应用程序名称作为关键字?

iOS app: keep old application name as keyword?

我需要重命名我的应用程序的名称。

是否可以在某处存储其旧名称的一些元数据? 用户可以尝试在 iPhone 的搜索选项中搜索其旧名称。

是否在plist文件或其他地方指定值,使其bundle显示名称为新名称,而旧名称仍可搜索?

为此,您的应用程序必须至少启动一次,并且在 AppDelegatedidFinishLaunchingWithOptions: 中,您可以索引 Core Spotlight 可搜索项目,如下所示:

CSSearchableItemAttributeSet* attributeSet = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:@"myApp.image"];

attributeSet.title = @"My Old App";
attributeSet.contentDescription = @"This application help you in acheiving so & so";
CSSearchableItem *item = [[CSSearchableItem alloc] initWithUniqueIdentifier:@"myApp" domainIdentifier:@"com.myapp" attributeSet:attributeSet];
// Index the item.
[[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:@[item] completionHandler: ^(NSError * __nullable error) {
    NSLog(@"Search item indexed");
}];

您甚至可以添加缩略图,以便在搜索旧名称的应用程序时显示;您需要在创建 searchableItem

之前添加以下代码
UIImage *image = [UIImage imageNamed:@"MercC"];
NSData *thumbNailData = UIImagePNGRepresentation(image);
attributeSet.thumbnailData = thumbNailData;