編輯

共用方式為


PreserveAttribute.Conditional Field

Definition

Flags the method as a method to preserve during linking if the container class is pulled in.

public bool Conditional;
val mutable Conditional : bool

Field Value

Remarks

If the Conditional value is set on a Preserve attribute on a method, then the method will be preserved if the containing NSObject is kept after the linker has done its job.

You would typically use this for callbacks that you know will be called in your code dynamically (for example with a selector invocation from Objective-C) since a static linker would not be able to infer that this particual method is required.

Applies to