Closed yakirn closed 5 years ago
When you click on the link - app is launched with controller A
. After that you handle link on the JS side and send command to your plugin to open another view controller (B
). After that I don't really understood...
If in B
you are trying to close it and then notify web page in controller A
about the result like this:
dispatch_async(dispatch_get_main_queue()) {
self.viewController?.dismissViewControllerAnimated(true, completion: { () -> Void in
self.commandDelegate?.sendPluginResult(result, callbackId:self.command.callbackId);
})
}
then I think it's wrong, because you are closing controller and then sending result. But if you execute self.viewController?.dismissViewControllerAnimated
in controller B
- then self.commandDelegate?.sendPluginResult
is from controller B
also. And he is dismissed. So that, most likely, would not work.
If you want to send results from controller B
to the page from controller A
- then before presenting controller B
you need to set to it some delegate. Then you are finished in B
- execute delegate method and pass the result to it; then close B
from A
. For example, as described in this tutorial.
But as I said, I might be missing some piece of the puzzle. If I do - please, correct me :)
Hi @nikDemyankov thanks for your response. I will try to explain my question better.
self
is the code is the plugin. So if I understood you correctly your first assumption is the closest one.
app is launched with controller A - this is Cordova's VC. After that I handle link on the JS side and send command to my plugin to open another view controller (B)
then I think it's wrong, because you are closing controller and then sending result
but this works if I open the normal way (clicking the icon on the homescreen). plus, I don't really understand the problem: Plugin P presents a VC B. the user interacts with B, then later B notifies P of some event (e.g didFinishPickingMediaWithInfo) via the delegate design pattern. P then dismiss b and send a result back to cordova using sendPluginResult. So I don't understand why dismissing VC B before sending the result will have any effect (and as I said, this if working in other situations) but if are indeed suggesting that switching the order of the commands might solve this I'll give it a try. Thanks again!
Thanks for clarification! Then your code seems correct and should work... But yes, maybe sending result to the page before closing VC might do the trick. Although, I doubt that... I suggested that, because thought that you are closing controller B from B, not from A.
đ Hi! Thank you for your interest in this repo.
đĸ We are not using nordnet/cordova-universal-links-plugin anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.
đ This will now be closed & locked.
âšī¸ Please see #160 for more information.
I believe this is not an issue with this plugin, but I hope maybe someone has managed to solve such a problem before and can help: Has anyone tried to use this plugin to launch another plugin that presents a UIViewController? please check out this SO question clarification: in my
didLaunchAppFromLink
I route my (backbone) app to start another plugin that usespresentViewController
to present a camera screen over my cordova app. Any feedback would be appreciated, Thanks!