I have included the 1Password extension in my Browser app by following this question.
However, I already have an iOS 8 Share Sheet (ActivityViewController) on my app and would like to include the 1Password inside this share sheet inside of using it's own. My app is in Swift but the 1Password is in Objective-C.
Here's the code I'm using for the 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)
}
}
}
And here's how the 1Password Extension code:
@IBAction func onePasswordButton(sender: AnyObject) {
OnePasswordExtension.sharedExtension().fillItemIntoWebView(self._webView, forViewController: self, sender: sender, showOnlyLogins: false, completion: {(Bool) in
// error handling
})
}
I tried using the code for the extension in the applicationActivities
part of the UIActivityViewController, but it doesn't work (Build Failed).
Is it possible to have the 1Password extension inside the ActivityViewController?
Thanks,
PastaCoder