共用方式為


NSUrlProtectionSpace 建構函式

定義

多載

NSUrlProtectionSpace(NSCoder)

從儲存在 unarchiver 物件中的資料初始化 物件的建構函式。

NSUrlProtectionSpace(NSObjectFlag)

呼叫衍生類別的建構函式,以略過初始化,並只配置 物件。

NSUrlProtectionSpace(IntPtr)

建立 Unmanaged 物件的 Managed 標記法時所使用的建構函式;由執行時間呼叫。

NSUrlProtectionSpace(String, Int32, String, String, String)
NSUrlProtectionSpace(String, Int32, String, String, String, Boolean)

NSUrlProtectionSpace(NSCoder)

從儲存在 unarchiver 物件中的資料初始化 物件的建構函式。

[Foundation.Export("initWithCoder:")]
[ObjCRuntime.DesignatedInitializer]
public NSUrlProtectionSpace (Foundation.NSCoder coder);
new Foundation.NSUrlProtectionSpace : Foundation.NSCoder -> Foundation.NSUrlProtectionSpace

參數

coder
NSCoder

unarchiver 物件。

屬性

備註

提供這個建構函式,以允許在 NIB 還原序列化) 期間,從 unarchiver (初始化 類別。 這是通訊協定的 NSCoding 一部分。

如果開發人員想要建立這個物件的子類別,並繼續支援從封存還原序列化,他們應該實作具有相同簽章的建構函式:採用類型的 NSCoder 單一參數,並使用 [Export (「initWithCoder:」] 屬性宣告加以裝飾。

您也可以使用隨附方法 EncodeTo 序列化這個物件的狀態。

適用於

NSUrlProtectionSpace(NSObjectFlag)

呼叫衍生類別的建構函式,以略過初始化,並只配置 物件。

protected NSUrlProtectionSpace (Foundation.NSObjectFlag t);
new Foundation.NSUrlProtectionSpace : Foundation.NSObjectFlag -> Foundation.NSUrlProtectionSpace

參數

t
NSObjectFlag

未使用的 sentinel 值,傳遞 NSObjectFlag.Empty。

備註

當衍生類別在 Managed 程式碼中完全建構物件時,應該呼叫這個建構函式,並只想要讓執行時間配置和初始化 NSObject。 這是實作 Objective-C 所使用的雙步驟初始化程式的必要條件,第一個步驟是執行物件配置,第二個步驟是初始化物件。 當開發人員叫用採用 NSObjectFlag.Empty 的建構函式時,它們會利用直接路徑,而直接路徑會移至 NSObject,只設定物件的記憶體,並將 Objective-C 和 C# 物件系結在一起。 物件的實際初始化會由開發人員決定。

系結產生器通常會使用此建構函式來設定物件,但會防止實際初始化發生。 配置完成之後,建構函式必須初始化 物件。 使用系結產生器所產生的建構函式,這表示它會手動叫用其中一個 「init」 方法來初始化 物件。

如果開發人員使用 NSObjectFlag.Empty 路徑鏈結物件,開發人員必須負責完全初始化物件。

一般而言,如果開發人員的建構函式叫用 NSObjectFlag.Empty 基底實作,則它應該呼叫 Objective-C init 方法。 如果這不是這種情況,開發人員應該改為將其類別中的適當建構函式鏈結在一起。

忽略引數值,而且只會確保唯一執行的程式碼是建構階段是基本的 NSObject 配置和執行時間類型註冊。 通常鏈結看起來會像這樣:

//
// The NSObjectFlag merely allocates the object and registers the
// C# class with the Objective-C runtime if necessary, but no actual
// initXxx method is invoked, that is done later in the constructor
//
// This is taken from Xamarin.iOS's source code:
//
[Export ("initWithFrame:")]
public UIView (System.Drawing.RectangleF frame) : base (NSObjectFlag.Empty)
{
// Invoke the init method now.
	var initWithFrame = new Selector ("initWithFrame:").Handle;
	if (IsDirectBinding)
		Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSend_CGRect (this.Handle, initWithFrame, frame);
	else
		Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_CGRect (this.SuperHandle, initWithFrame, frame);
}

適用於

NSUrlProtectionSpace(IntPtr)

建立 Unmanaged 物件的 Managed 標記法時所使用的建構函式;由執行時間呼叫。

protected internal NSUrlProtectionSpace (IntPtr handle);
new Foundation.NSUrlProtectionSpace : nativeint -> Foundation.NSUrlProtectionSpace

參數

handle
IntPtr

nativeint

指向 Unmanaged 物件的指標 (控制碼) 。

備註

執行時間基礎結構會叫用此建構函式 () GetNSObject(IntPtr) ,為 Unmanaged Objective-C 物件的指標建立新的 Managed 標記法。 開發人員不應該直接叫用此方法,而是應該呼叫 GetNSObject 方法,因為它會防止 Managed 物件的兩個實例指向相同的原生物件。

適用於

NSUrlProtectionSpace(String, Int32, String, String, String)

public NSUrlProtectionSpace (string host, int port, string protocol, string realm, string authenticationMethod);
new Foundation.NSUrlProtectionSpace : string * int * string * string * string -> Foundation.NSUrlProtectionSpace

參數

host
String
port
Int32
protocol
String
realm
String
authenticationMethod
String

適用於

NSUrlProtectionSpace(String, Int32, String, String, String, Boolean)

public NSUrlProtectionSpace (string host, int port, string protocol, string realm, string authenticationMethod, bool useProxy);
new Foundation.NSUrlProtectionSpace : string * int * string * string * string * bool -> Foundation.NSUrlProtectionSpace

參數

host
String
port
Int32
protocol
String
realm
String
authenticationMethod
String
useProxy
Boolean

適用於