您可使用<条码>开放式URL:,从份额延伸到主要应用。
将这一职能称为控制员分担延期
func openContainerApp(with url: URL) async {
guard let items = self.extensionContext?.inputItems as? [NSExtensionItem], !items.isEmpty else {
return
}
defer {
extensionContext?.completeRequest(returningItems: nil, completionHandler: nil)
}
let selector = sel_registerName("openURL:")
var responder = self as UIResponder?
while responder != nil {
if responder!.responds(to: selector) {
responder!.perform(selector, with: url)
break
}
responder = responder?.next
}
}
and main application can receive the url in app delegate func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool