1
我有一个应用程序,我想添加消息扩展功能。iOS消息扩展程序如何直接切换主机应用程序
我认为功能是,如果用户选择一条消息,它直接切换我的主机应用程序像谷歌地图。
我做了一个MSMessage并设置了URL,并且该消息有模板布局,其中有标题和子标题。
let message = MSMessage()
message.url = "http://blahblah?customScheme=myHostAppLaunchScheme"
let template = MSMessageTemplateLayout()
template.image = sampleImage
template.caption = "this is a caption"
template.subCaption = "this is a sub caption"
message.layout = template
guard let conversation = activeConversation else {
print("blahblah")
return
}
conversation.insert(message) { (error) in
print("finish. error = \(error == nil ? "nil" : error!.localizedDescription)")
}
,我在
willBecomeActive(with conversation: MSConversation)
didReceive(_ message: MSMessage, conversation: MSConversation)
当然
写了一码extensionContext.open(URL,completionHandler),我解析selectedMessage的URL。
但它没有工作我期望。
消息扩展开关自动扩展模式。
如果我用
conversation.insertText("myHostAppLaunchScheme", nil)
,但我不希望它,因为它不能添加模板:(
它的工作原理是有什么想法切换iMessage的直接主持的应用程序?
感谢您的任何想法。