我正在 xamarin 上創建一個演示專案,其中我需要將如下所述的 AppDelegate 類添加到現有的 AppDelegate.cs 檔案中。因為我是這種事情的新手,如果你能在這方面指導我,那就太好了。
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
// Your code.
return true
}
}
uj5u.com熱心網友回復:
OpenUrl您可以在Xamarin 專案中覆寫AppDelegate.cs以提供該功能
namespace yourapp.host.ios
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
return base.FinishedLaunching(app, options);
}
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
// Your code.
return true;
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/439958.html
