Search Issue Tracker

By Design

Votes

0

Found in

2018.4

2019.4

2019.4.12f1

Issue ID

1317669

Regression

No

[macOS] Objective-C @available invoked from a bundle returns false on available macOS versions

MacOS

-

Steps to reproduce:
1. Open the project attached by the user
2. Open "scene"
3. Enter Play mode

Expected result: @available from bundle returns true on all versions that are available
Actual result: @available from bundle returns false for 11.0 and 11.1 (tested on 11.1)

Reproducible with: 2018.4.32f1, 2019.4.22f1
Not reproducible with: 2020.3.0f1, 2021.1.0b11, 2021.2.0a8

Notes:
- Doesn't reproduce with 2019.4.22f1 when build is launched from Xcode project (Xcode 12.3 used)
- Likely related to being built with an older Xcode version

  1. Resolution Note (2021.2.X):

    this is issue is coming from the way @available clauses are handled. Using it will result in code generated that does something like
    if(__isPlatformVersionAtLeast(...)) {...}
    where __isPlatformVersionAtLeast is *statically linked* function in the main app.
    I reiterate, the check for current OS version is built into the app itself. And what happens, essentially, that SDK version you built with impacts the "known" OS version, so if you build with "old" SDK, than, say, 11.0 will become, say, 10.16 (the largest OS version known to SDK used to build the app.)
    Sure enough, when you build macos player "normaly" you get app bundle that unity have built, and sure enough this cannot be the "latest available sdk".
    Well, not exactly "cannot": for example if i run your project on the latest development unity version it works fine (because we have updated the toolchaion internally to newer xcode).
    But not all is lost! You can build your project with "Create Xcode Project" checked in build window, which will generate xcode project that you can build with newest xcode, and then everything will just work

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.