xamarin - How to await iOS openURL overridden method? -


i have share feature in mail application can open application clicking share button. able open app when user click share mail app, issue openurl method.

below openurl method:

public override bool openurl(uiapplication application, nsurl url, string sourceapplication, nsobject annotation) {     upload(url);     return true; }  async public task<bool> upload(nsurl shareduri) {   //upload  } 

problem above code since upload function not awaited, before upload function finishes app opened.

how can await task in openurl?

you have many options here, 1 of returning upload's result. remember await time consuming task inside of upload.

public override bool openurl(uiapplication application, nsurl url, string sourceapplication, nsobject annotation) {         return this.upload(url).result; }  async public task<bool> upload(nsurl shareduri) {       await someuploadtask();       return true; } 

i agree sunil should show indication of action user, here's control should use: https://developer.xamarin.com/api/type/xamarin.forms.activityindicator/


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -