Как получить заголовок страницы с помощью swift в расширении общего доступа

Я разрабатываю расширение общего доступа, которое используется в сафари. Я мог бы получить URL-адрес расширения общего доступа. но я не могу получить заголовок страницы.

let puclicURL = String(kUTTypeURL)
if itemProvider.hasItemConformingToTypeIdentifier(puclicURL) {
    itemProvider.loadItem(forTypeIdentifier: puclicURL, options: nil, completionHandler: { 
        (item, error) in
            if let url: NSURL = item as? NSURL {
                print("url", url)
                // I want page title also
            }
        }
   }

И я попробовал код ниже. https://stackoverflow.com/a/33139355/5060282 Я думаю, что код ниже может работать только в расширении действия. не делиться расширением.

let propertyList = String(kUTTypePropertyList)
        if itemProvider.hasItemConformingToTypeIdentifier(propertyList) {
            itemProvider.loadItem(forTypeIdentifier: propertyList, options: nil, completionHandler: { (item, error) -> Void in
                let dictionary = item as! NSDictionary
                OperationQueue.main.addOperation {
                    let results = dictionary[NSExtensionJavaScriptPreprocessingResultsKey] as! NSDictionary
                    let title = NSURL(string: (results["title"] as! String))
                    //yay, you got the title now
                    print(title)
                }
            })
        } else {
            print("error")
        }
// But, error...

person oxygen    schedule 30.10.2017    source источник
comment
Вы распечатали свой словарь результатов?   -  person Francesco Deliro    schedule 30.10.2017
comment
Ой ну спасибо! ›› let title = NSURL(string: (results[title] as! String)) этот код отсутствует. приведенный ниже код правильный пусть title = results[title] as! Нить   -  person oxygen    schedule 30.10.2017
comment
второй фрагмент кода может выполняться в ShareExtension. Вы зарегистрировали NSExtensionActivationSupportsWebURLWithMaxCount или NSExtensionActivationSupportsWebPageMaxCount в своем plist?   -  person Hilmar Demant    schedule 10.11.2017