Skip to content

Conditionally running binding code in specific iOS version lead crash #23059

Closed as not planned
@jingliancui

Description

@jingliancui

Apple platform

iOS

Framework version

net9.0-*

Affected platform version

newest vscode

Description

There is a binding project that written with iOS 18 api.
But my app only a small feature need this binding project.
So I want to make this api disable in the lower iOS version.

But exception throw when I try below steps:

Crash with below log

Steps to Reproduce

  1. binding setting
  <ItemGroup>
    <XcodeProject Include="../native/NewBinding/NewBinding.xcodeproj">
      <SchemeName>NewBinding</SchemeName>
      <!-- Metadata applicable to @(NativeReference) will be used if set, otherwise the following defaults will be used:
      <Kind>Framework</Kind>
      <SmartLink>true</SmartLink>
      -->
    </XcodeProject>
  </ItemGroup>
  1. app setting
    <ItemGroup Condition="$(TargetFramework.Contains('ios'))">
        <ProjectReference Include="..\SubtitleUIBinding\NewBinding.MaciOS.Binding\NewBinding.MaciOS.Binding.csproj" />
    </ItemGroup>
  1. Invoke binding api with condition block
	private void TryBtn_Clicked(object sender, EventArgs e)
	{
#if IOS18_0_OR_GREATER
		var theSourceTextModel = new SomeBinding.SourceModel();
#endif
	}
  1. Run in iphone15 simulator which is iOS 17.4

Did you find any workaround?

No

Relevant log output

  Referenced from: <F50A89EB-0069-38D0-AFEB-0E3BD97FD137> /Users/ericcui/Library/Developer/CoreSimulator/Devices/6DDC4C6B-A6EC-468B-AF41-0E7BF29C2D78/data/Containers/Bundle/Application/B57F7C76-12C8-4698-A05C-CB9D70501D00/SampleApp.app/Frameworks/NewBinding.framework/NewBinding (built for iOS-sim 18.0 which is newer than running OS)

  Expected in:     <7B2AF674-532C-32AE-939D-3B38A9A7F087> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Translation.framework/Translation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions