Я включил расширение 1Password в свое приложение для браузера, следуя этому вопрос.
Однако у меня уже есть общий лист iOS 8 (ActivityViewController) в моем приложении, и я хотел бы включить 1Password в этот общий лист внутри использования его собственного. Мое приложение на Swift, но 1Password на Objective-C.
Вот код, который я использую для ActivityViewController:
@IBAction func _shareButton(sender: UIButton) {
var shareContent = _searchBar.text
if let myWebsite = NSURL(string: "\(_searchBar.text)")
{
let objectsToShare = [myWebsite]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
// The app is running on an iPad, so you have to wrap it in a UIPopOverController
var popOver: UIPopoverController = UIPopoverController(contentViewController: activityVC)
let rect = CGRect(origin: CGPoint(x: 559, y: 44), size: CGSize(width: 38, height: 32))
// if your "share" button is a UIBarButtonItem
popOver.presentPopoverFromRect(rect, inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)
} else {
self.presentViewController(activityVC, animated: true, completion: nil)
}
}
}
А вот как выглядит код расширения 1Password:
@IBAction func onePasswordButton(sender: AnyObject) {
OnePasswordExtension.sharedExtension().fillItemIntoWebView(self._webView, forViewController: self, sender: sender, showOnlyLogins: false, completion: {(Bool) in
// error handling
})
}
Я попытался использовать код для расширения в части applicationActivities
UIActivityViewController, но он не работает (сбой сборки).
Возможно ли иметь расширение 1Password внутри ActivityViewController?
Спасибо,
PastaCoder