Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

iOS 16+ crash #30

Closed
V0odo0 opened this issue Jan 12, 2023 · 14 comments
Closed

iOS 16+ crash #30

V0odo0 opened this issue Jan 12, 2023 · 14 comments
Labels
question Further information is requested

Comments

@V0odo0
Copy link

V0odo0 commented Jan 12, 2023

We're facing the crash that starts to appear after upgrading NatDevice from old AssetStore version to 1.3.2 on iOS 16.1 and 16.2. App is passing NatML access token validation and camera access in the first scene, but crashes when right before loading the second. No crash on iOS 15.x.

That is from XCode log:

2023-01-11 21:06:46.976322+0300 i-Shooter[4880:325181] [as_client]     AVAudioSession_iOS.mm:2374  Failed to set category, error: '!pri'
i-Shooter(4880,0x225f63ac0) malloc: Heap corruption detected, free list is damaged at 0x282f81840
*** Incorrect guard value: 759412347317
i-Shooter(4880,0x225f63ac0) malloc: *** set a breakpoint in malloc_error_break to debug
i-Shooter(4880,0x225f63ac0) malloc: Heap corruption detected, free list is damaged at 0x282f81840
*** Incorrect guard value: 759412347317
(lldb) 

And here is exception breakpoint:

int main(int argc, char* argv[])
{
    @autoreleasepool
    {
        id ufw = UnityFrameworkLoad();
        [ufw runUIApplicationMainWithArgc: argc argv: argv];
        return 0;
    }
}
@olokobayusuf
Copy link
Contributor

This seems to be happening because another app is in control of the microphone. When the crash happens, do you have a call or another app recording the mic?

@olokobayusuf olokobayusuf added the question Further information is requested label Jan 12, 2023
@olokobayusuf
Copy link
Contributor

Looking online, it seems that a fair number of developers have been facing a similar issue with iOS 16.

@V0odo0
Copy link
Author

V0odo0 commented Jan 12, 2023

No, but we have another plugin that is used for audio recording. Will look into it tomorrow.

@olokobayusuf
Copy link
Contributor

@V0odo0 Sounds good.

@V0odo0
Copy link
Author

V0odo0 commented Jan 14, 2023

Tested with disabled Speech To Text plugin. Same crash.

No crash on iPhone 11 with iOS 16.2.

Our app with old version of NatDevice is working fine. Indeed there is something related to NatDevice. Any thoughts?

@olokobayusuf
Copy link
Contributor

olokobayusuf commented Jan 16, 2023

Try out the following and let me know the result:

  1. In Player Settings, make sure that Prepare iOS for Recording is enabled.
  2. In code, before doing new MediaDeviceQuery, add the following:
MediaDeviceQuery.ConfiguresAudioSession = false;

@olokobayusuf
Copy link
Contributor

@V0odo0 I got around to testing this on iOS 16.2, wasn't able to repro. I mentioned this earlier:

This seems to be happening because another app is in control of the microphone. When the crash happens, do you have a call or another app recording the mic?

Can you confirm that there isn't another app running that is already using the microphone?

@V0odo0
Copy link
Author

V0odo0 commented Jan 18, 2023

Try out the following and let me know the result:

  1. In Player Settings, make sure that Prepare iOS for Recording is enabled.
  2. In code, before doing new MediaDeviceQuery, add the following:
MediaDeviceQuery.ConfiguresAudioSession = false;

Didn't help unfortunately.

@V0odo0 I got around to testing this on iOS 16.2, wasn't able to repro. I mentioned this earlier:

This seems to be happening because another app is in control of the microphone. When the crash happens, do you have a call or another app recording the mic?

Can you confirm that there isn't another app running that is already using the microphone?

Yes. We disabled microphone usage for all apps in iOS settings. Our app is not in the list since it is not using microphone.

We experience this crash on at least two devices (iPhone 14 with iOS 16.2). No crash on iPhone 11 with iOS 16.2.

@V0odo0
Copy link
Author

V0odo0 commented Jan 23, 2023

The issue was resolved after iOS 16.3 fresh update. Looks like this bug was specific for iPhones 14 with iOS 16.2.

@V0odo0 V0odo0 closed this as completed Jan 23, 2023
@olokobayusuf
Copy link
Contributor

That sounds good. Thanks for letting me know.

@V0odo0
Copy link
Author

V0odo0 commented Jan 24, 2023

That sounds good. Thanks for letting me know.

Whoops. Actually it was the first succesfull application launch. But second time we got a crash again. iPhone 13 as well.

What I'm noticed that the crash occurs randomly (but most of the time) when we querying video devices. iOS just killing the application. Maybe it happens because of high CPU usage spike?

@V0odo0 V0odo0 reopened this Jan 24, 2023
@olokobayusuf
Copy link
Contributor

What I'm noticed that the crash occurs randomly (but most of the time) when we querying video devices. iOS just killing the application. Maybe it happens because of high CPU usage spike?

This shouldn't be the case. When the app crashes, can you share the logs from Xcode? iOS (along with macOS) are pretty diligent about collecting call stacks/stack traces when a crash occurs, so Xcode should always be able to catch the crash so you can inspect it. Share away!

@V0odo0
Copy link
Author

V0odo0 commented Jan 24, 2023

What I'm noticed that the crash occurs randomly (but most of the time) when we querying video devices. iOS just killing the application. Maybe it happens because of high CPU usage spike?

This shouldn't be the case. When the app crashes, can you share the logs from Xcode? iOS (along with macOS) are pretty diligent about collecting call stacks/stack traces when a crash occurs, so Xcode should always be able to catch the crash so you can inspect it. Share away!

XCode log is in the first post.

Here is the part of the code where we querying for devices:
var filter = MediaDeviceCriteria.CameraDevice;
var query = new MediaDeviceQuery(filter);
foreach (var q in query)
{
var device = q as CameraDevice;
if (device != null)
all.Add(new NatDeviceVideoStream.Info(device));
}

@olokobayusuf
Copy link
Contributor

If the error remains the exact same, then it's safe to assume that this is still an iOS issue. So I'll close this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants