RenderHeads / UnityPlugin-AVProMovieCapture

AVPro Movie Capture is a Unity Plugin for advanced video capture to AVI/MP4/MOV files
https://renderheads.com/products/avpro-movie-capture/
49 stars 8 forks source link

[Bug] Xcode 15 Crash #379

Closed nikolay-fomichev-nl closed 8 months ago

nikolay-fomichev-nl commented 8 months ago

Unity Version

2021.3.24f1, 2023.2.15f1

AVPro Movie Capture Version

5.2.4

Which platform(s) are you using?

iOS

Which OS version(s) are you using?

iOS 13+

Which rendering API(s) are you using?

Metal

Hardware

iPhone XR

Which capture component are you using?

Capture From Screen

Capture mode

Realtime

Which output mode are you using?

Video file

Video codecs

H264

Audio source

None

Audio codecs

AAC

Any other component configuration

No response

The issue

Hello.

Soon we'll need to use Xcode 15 to build App Store apps and I'm having an issue with AVProMovieCapture. Whenever I open a Unity scene where AVProMovieCapture is used the app crashes with the following message:

dyld[3177]: missing symbol called

This is happening on the following line of AVProMovieCapture.m file:

AVPMC_UnityRegisterRenderingPlugin(UnityRegisterRenderingPluginV5);

This happens if the project is built using the latest Xcode 15 (15.3 at the moment), but it is not happening if the project is built using Xcode 14.3.

Starting April 29, 2024 all apps submitted into App Store must be built with Xcode 15 - https://developer.apple.com/news/upcoming-requirements/?id=04292024a.

Log output

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: DYLD 9 
missing symbol called

Triggered by Thread:  0

Kernel Triage:
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   dyld                                   0x1aee3acfc __terminate_with_payload + 8
1   dyld                                   0x1aee428b8 abort_with_payload_wrapper_internal + 135
2   dyld                                   0x1aee428cc abort_with_payload + 15
3   dyld                                   0x1aee06e78 dyld4::halt(char const*, dyld4::StructuredError const*) + 303
4   dyld                                   0x1aee20278 dyld4::APIs::_dyld_missing_symbol_abort() + 27
5   UnityFramework                         0x11838ab0c AVPMC_PluginBootstrap + 20
6   UnityFramework                         0x11a7a7ce4 NativePlugin_MCPluginBootstrap_m5D0C5999D38BEA4C7A60DE18DD47B08F4D0ADBDA + 20
7   UnityFramework                         0x11a7a8600 NativePlugin__cctor_m9BA858F31232464BDA5A6B0F79CED2683D1A647D + 2320
8   UnityFramework                         0x1180ef3b4 RuntimeInvoker_FalseVoid_t4861ACF8F4594C3437BB48B6E56783494B843915(void (*)(), MethodInfo const*, void*, void**, void*) + 44
9   UnityFramework                         0x11925a034 il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**) + 100
10  UnityFramework                         0x119259e94 il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) + 84
11  UnityFramework                         0x1192583c4 il2cpp::vm::Runtime::ClassInit(Il2CppClass*) + 688
12  UnityFramework                         0x117d030ec il2cpp_codegen_runtime_class_init_inline(Il2CppClass*) + 48
13  UnityFramework                         0x11a7aebf0 CaptureBase_Awake_m898AC2C641308AC16341F70E389ACC587751A8D4 + 380
14  UnityFramework                         0x11807ffc8 RuntimeInvoker_TrueVoid_t4861ACF8F4594C3437BB48B6E56783494B843915(void (*)(), MethodInfo const*, void*, void**, void*) + 48
15  UnityFramework                         0x11925a034 il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**) + 100
16  UnityFramework                         0x119259e94 il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) + 84
17  UnityFramework                         0x1185e60b0 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool) + 112
18  UnityFramework                         0x1185f1a58 ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) + 120
19  UnityFramework                         0x1185f3f6c ScriptingInvocation::InvokeChecked(ScriptingExceptionPtr*) + 60
20  UnityFramework                         0x118641234 SerializableManagedRef::CallMethod(Object&, ScriptingMethodPtr) + 96
21  UnityFramework                         0x118601c6c MonoBehaviour::CallAwake() + 136
22  UnityFramework                         0x1186020a0 MonoBehaviour::AddToManager() + 224
23  UnityFramework                         0x118601bc8 MonoBehaviour::AwakeFromLoad(AwakeFromLoadMode) + 672
24  UnityFramework                         0x1186425b4 AwakeFromLoadQueue::InvokePersistentManagerAwake(AwakeFromLoadQueue::Item*, unsigned int, AwakeFromLoadMode, bool) + 332
25  UnityFramework                         0x1186423b8 AwakeFromLoadQueue::PersistentManagerAwakeFromLoad(int, AwakeFromLoadMode, bool) + 148
26  UnityFramework                         0x11864230c AwakeFromLoadQueue::PersistentManagerAwakeFromLoad(ErrorsAndWarningsCapture*, bool) + 40
27  UnityFramework                         0x1184f82f4 LoadSceneOperation::CompleteAwakeSequence() + 148
28  UnityFramework                         0x1184f85e0 LoadSceneOperation::CompletePreloadManagerLoadScene() + 36
29  UnityFramework                         0x1184f7ee0 LoadSceneOperation::PlayerLoadSceneFromThread() + 584
30  UnityFramework                         0x1184f7bb8 LoadSceneOperation::IntegrateMainThread() + 120
31  UnityFramework                         0x1184f8f74 PreloadManager::UpdatePreloadingSingleStep(PreloadManager::UpdatePreloadingFlags, int) + 224
32  UnityFramework                         0x1184f98e0 PreloadManager::UpdatePreloading() + 276
33  UnityFramework                         0x1184edd54 ExecutePlayerLoop(NativePlayerLoopSystem*) + 100
34  UnityFramework                         0x1184edd94 ExecutePlayerLoop(NativePlayerLoopSystem*) + 164
35  UnityFramework                         0x1184edff0 PlayerLoop() + 272
36  UnityFramework                         0x118c390c4 UnityPlayerLoopImpl(bool) + 112
37  UnityFramework                         0x117cf2fd8 UnityRepaint + 28
38  UnityFramework                         0x117cf2fac -[UnityAppController(Rendering) repaint] + 116
39  UnityFramework                         0x117cf2efc -[UnityAppController(Rendering) repaintDisplayLink] + 120
40  QuartzCore                             0x18d681010 CA::Display::DisplayLinkItem::dispatch_(CA::SignPost::Interval<(CA::SignPost::CAEventCode)835322056>&) + 47
41  QuartzCore                             0x18d6841f8 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 863
42  QuartzCore                             0x18d683d04 CA::Display::DisplayLink::callback(_CADisplayTimer*, unsigned long long, unsigned long long, unsigned long long, bool, void*) + 843
43  QuartzCore                             0x18d6811a8 display_timer_callback(__CFMachPort*, void*, long, void*) + 371
44  CoreFoundation                         0x18c07bda4 __CFMachPortPerform + 175
45  CoreFoundation                         0x18c07bce0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 59
46  CoreFoundation                         0x18c07a768 __CFRunLoopDoSource1 + 519
47  CoreFoundation                         0x18c079da0 __CFRunLoopRun + 2243
48  CoreFoundation                         0x18c0793f8 CFRunLoopRunSpecific + 607
49  GraphicsServices                       0x1cf6074f8 GSEventRunModal + 163
50  UIKitCore                              0x18e49f8a0 -[UIApplication _run] + 887
51  UIKitCore                              0x18e49eedc UIApplicationMain + 339
52  APP_NAME_HERE                          0x100e427cc main + 148
53  dyld                                   0x1aedcedcc start + 2239
MorrisRH commented 8 months ago

Hey @nikolay-fomichev-nl, I'm unable to reproduce this here using a fresh project and the Demo00-ScreenCapture scene with:

Failing to find the symbol would suggest the plugin isn't being copied into the built Xcode project correctly. It should be listed in the "Frameworks, Libraries and Embedded Content" of the Unity-iPhone target as shown here: Screenshot 2024-03-26 at 10 09 23

nikolay-fomichev-nl commented 8 months ago

Hello @MorrisRH. I checked the project - embed type is set to "Embed & Sign" for AVProMovieCapture and I can find the framework inside of Frameworks folder in the final .app file. I will try to reproduce the issue on a sample project.

Comparing to your setup, though, we have Unity embedded as a library - we do not have standalone Unity application. Could it be somehow related to that?

MorrisRH commented 8 months ago

Yeah, Unity as a library is the issue here. You need to remove AVProMovieCapture.framework from the Unity-iPhone target and add it to your application target's list of frameworks.

nikolay-fomichev-nl commented 8 months ago

Hello. A quick update - the issue was in the build settings of the application target in the project. After fixing them I get AVProMovieCapture running on Xcode 15 as expected without any crashes. Thank you for looking into it.