iOS 18快捷指令中无法显示原生日期选择器的问题求助
iOS 18快捷指令中无法显示原生日期选择器的问题求助
各位iOS开发的大佬们,求帮忙看看这个头疼的问题!我现在在iOS 18里给自家App做快捷指令扩展,原本想让其中的日期参数能像苹果自带提醒事项那样,唤起原生的日期选择器(就是创建提醒时那种带日历弹窗的交互选择器),但不管怎么折腾,这个日期字段始终只是个普通的文本输入框,完全出不来原生的选择器界面。
我已经试过清理Build文件夹、删除App重新安装这些常规排错操作了,但一点用都没有。下面是我的Intent代码:
struct CreateRecordIntent: AppIntent { static var name: String = "createRecordShortcut" static var title: LocalizedStringResource = "Record.Create" static var description: IntentDescription = "Record.Create.Description" static var openAppWhenRun: Bool = true @Parameter( title: "DateAndTime", default: Date() ) var date: Date func perform() async throws -> some IntentResult { var userInfo: [AnyHashable: Any] = [:] NotificationCenter.default.post(name: .createRecordShortcut, object: nil, userInfo: userInfo.isEmpty ? nil : userInfo) return .result() } }
就像苹果提醒事项在快捷指令里的创建日期选择器那种原生交互,才是我想要的效果。有没有大佬知道我哪里写错了?或是iOS 18里有没有什么新的配置项是我漏掉的?麻烦指点一下,万分感谢!




