我有一个包含视频内容的应用程序,我跟踪所有查看的项目NSUserActivity
以将其添加到 Spotlight。结果看起来很完美,除了年份日期,它总是NSUserActivity
被添加到索引中的年份。但我需要将其更改为电影的发行年份。
let activity = NSUserActivity(activityType: "com.bundleid.movie")
activity.isEligibleForSearch = true
activity.title = "Mess"
let movie = kUTTypeMovie as String
let attributes = CSSearchableItemAttributeSet(itemContentType: movie)
attributes.title = "Mess"
attributes.contentDescription = "Even if you get behind bars..."
attributes.thumbnailData = try? Data(contentsOf: thumbURL) // cover
attributes.rating = NSNumber(value: 3.7)
attributes.ratingDescription = "(Kinopoisk: 7.9, IMDb: 7.4)"
attributes.duration = NSNumber(value: 5785) // 1:36:25 in sec
attributes.contentCreationDate = dateFormatter.date(from: "1989") // ¯\_(ツ)_/¯
activity.contentAttributeSet = attributes
我不仅尝试设置,attributes.contentCreationDate
而且还addedDate
尝试设置CSSearchableItemAttributeSet_Media.h
. 但它总是2018
(