Hi!
When can we expect an ability to build an working iOS app with xCode 12?
Currently we have a sample, empty project and so far it:
builds and runs when built using xCode 11.5 on iOS 13.5
xCode project fails to build when using xCode 12 (beta 4)
An error is thrown for MetalHelper.mm : 300 saying that “No known instance method for selector 'presentDrawable:afterMinimumDuration`”. See code below the post.
After removal of the problematic line (so that presentDrawable is called without a parameter which is a fallback solution for iOS < 10.3) the project builds fine but once the app is started it crashes with SIGABRT on UnityInitApplicationGraphics();, line 130 of UnityAppController.mm
The problematic code:
extern "C" void PresentMTL(UnityDisplaySurfaceMTL* surface)
{
if (surface->drawable)
{
#if PLATFORM_IOS || PLATFORM_TVOS
if (@available(iOS 10.3, tvOS 10.3, *))
{
const int targetFPS = UnityGetTargetFPS(); assert(targetFPS > 0);
[UnityCurrentMTLCommandBuffer() presentDrawable: surface->drawable afterMinimumDuration: 1.0 / targetFPS]; // Error is here
return;
}
#endif
// note that we end up here if presentDrawable: afterMinimumDuration: is not supported
[UnityCurrentMTLCommandBuffer() presentDrawable: surface->drawable];
}
}
When I try this solution, the game builds fine but after launching the game, it gets stuck at black screen for a few seconds and then crashes (the same problem @marcin-matczak is having). Did it not happen to you @PuzzlElite ? On which Unity version did it run without any issues? Which Graphics APIs were included in Player Settings?
Why not? Even in Unity 2020.1 you can’t run iOS apps in Simulator when using XCode 12.
XCode 12 is required now to build apps for iOS 14 so I guess everyone will have updated within a few weeks.
Error in XCode:
no known instance method for selector
MetalHelper.mm```
@Magistr_AVSH On which Unity version did it run without any issues? Which Graphics APIs were included in Player Settings? Did you test it on an iOS 14 simulator or iOS 13 simulator? Because it works on iOS 13 simulator but I can’t get it to work on iOS 14 simulator.
I’m trying to port my game to iOS now. I’ve changed the presentDrawable call as suggested above, and I have Metal Editor Support turned off. But the app immediately quits upon launch. The log in Xcode says:
I’m using Unity 2019.3.9f1 and XCode 12.0.1 (under macOS 10.15.7). I’m willing to upgrade if necessary, though I would prefer to keep the final game compatible with older devices as much as possible.
Any idea how to make this work?
EDIT: I found the additional project settings to change (uncheck Auto Graphics API, and drag OpenGLES2 up above Metal). But now the build just fails in a different way:
Happens with both the iPhone 11 and iPhone 8 simulators. A frustrating experience, to be sure. Any advice appreciated.
the fix for presentDrawable: should be in the latest 2019.4 (well, i am too lazy to check exact version)
2019.4 does not support metal on simulator (we have added support in 2020)
this explains
ios gles is deprecated (and was removed in 2020), but i guess we want to be sure apps can be run on simulator, can we have a bug report with small repro case about
Hello! Don’t know if you still have that issue but after reading the issue and trying different stuff, what worked for me was to
First. Change the presentDrawable like mentioned above (… atTime: 1.0 / targetFPS ) and then go to: Targets > UnityFramework > Build Phases > Link Binary With Libraries and add: GameKit.framework. (just click on the + button and write gamekit, you should find it automatically) . do the same for your project target ( Targets > Your Project > Build Phases etc.