We found that crashes occur on some specific devices. But don't know the root cause for it. It only appears on the user side and cannot be reproduced on our local devices.
From the stack, a crash occurs inside AVCapture after calling discoverySessionWithDeviceTypes:
NSArray<AVCaptureDevice*>* GetVideoCaptureDevices() {
NSArray* captureDeviceType = @[
AVCaptureDeviceTypeBuiltInWideAngleCamera,
AVCaptureDeviceTypeExternalUnknown
];
AVCaptureDeviceDiscoverySession* deviceDiscoverySession =
[AVCaptureDeviceDiscoverySession
discoverySessionWithDeviceTypes:captureDeviceType
mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionUnspecified];
return deviceDiscoverySession.devices;
}
The following is the crash call stack:
OS Version: macOS 13.5 (22G74)
Report Version: 104
Crashed Thread: 10301
Application Specific Information:
Fatal Error: EXC_BAD_INSTRUCTION / EXC_I386_INVOP / 0x7ff8194b3522
Thread 10301 Crashed:
0 AppKit 0x7ff8194b3522 -[NSApplication _crashOnException:]
1 AppKit 0x7ff8194b32b3 -[NSApplication reportException:]
2 AppKit 0x7ff819569efa NSApplicationUncaughtExceptionHandler
3 CoreFoundation 0x7ff8161c010a <unknown>
4 libobjc.A.dylib 0x7ff815c597c8 <unknown>
5 libc++abi.dylib 0x7ff815f926da std::__terminate
6 libc++abi.dylib 0x7ff815f92695 std::terminate
7 libobjc.A.dylib 0x7ff815c65929 <unknown>
8 libdispatch.dylib 0x7ff815e38046 _dispatch_client_callout
9 libdispatch.dylib 0x7ff815e39266 _dispatch_once_callout
10 AVFCapture 0x7ff8328cafb6 +[AVCaptureDALDevice devices]
11 AVFCapture 0x7ff832996410 +[AVCaptureDevice_Tundra _devicesWithAllowIOSMacEnvironment:]
12 AVFCapture 0x7ff83299652b +[AVCaptureDevice_Tundra _devicesWithDeviceTypes:mediaType:position:allowIOSMacEnvironment:]
13 AVFCapture 0x7ff83299e8c0 -[AVCaptureDeviceDiscoverySession_Tundra _initWithDeviceTypes:mediaType:position:allowIOSMacEnvironment:prefersUnsuspendedAndAllowsAnyPosition:]
14 AVFCapture 0x7ff83299e7a4 +[AVCaptureDeviceDiscoverySession_Tundra discoverySessionWithDeviceTypes:mediaType:position:]
15 Electron Framework 0x119453784 media::GetVideoCaptureDevices (video_capture_device_avfoundation_helpers.mm:22)
I want to know what is the root cause of this crash.
How should I simulate it and fix it?
Any suggestions would be highly appreciated. Thank you.
Post
Replies
Boosts
Views
Activity
When I startAdvertising, my localName is long, more than 8 bytes. like @"123456789".
[_peripheralManager startAdvertising:@{
CBAdvertisementDataLocalNameKey: @"123456789",
CBAdvertisementDataServiceUUIDsKey: @[[CBUUID UUIDWithString:@"bbbb14c7-4697-aaaa-b436-d47e3d4ed187"]]
}];
When running on macOS 11.x though localName exceeds 8 bytes. But it can still be scanned.
{
kCBAdvDataIsConnectable = 1;
kCBAdvDataLocalName = 123456789;
kCBAdvDataRxPrimaryPHY = 0;
kCBAdvDataRxSecondaryPHY = 0;
kCBAdvDataServiceUUIDs = (
"BBBB14C7-4697-AAAA-B436-D47E3D4ED187"
);
kCBAdvDataTimestamp = "680712553.800874";
kCBAdvDataTxPowerLevel = 12;
}
But running after macOS 12.x, if localName exceeds 8 bytes, it will be completely ignored. In the scanned data, localName is empty.
{
kCBAdvDataIsConnectable = 1;
kCBAdvDataRxPrimaryPHY = 0;
kCBAdvDataRxSecondaryPHY = 0;
kCBAdvDataServiceUUIDs = (
"BBBB14C7-4697-AAAA-B436-D47E3D4ED187"
);
kCBAdvDataTimestamp = "680712744.108894";
kCBAdvDataTxPowerLevel = 12;
}
On macOS11.x, SCAN_RSP is utilized if localName exceeds 8 bytes,
while on macOS12.x, SCAN_RSP is always empty.
Why are there differences between macOS11.x and macos12.x, is there any documentation?
What is the maximum limit for localName? (On macOS 11.x, I verified it was 29 bytes
Are there other ways to broadcast longer data?
Does anyone know why? This has bothered me for a long time...
I have an iOS App as peripheral which advertises packets.
NSDictionary *advertise = @{CBAdvertisementDataLocalNameKey : shortName, CBAdvertisementDataServiceUUIDsKey: @[[CBUUID UUIDWithString:uuidA]]};
[self.manager startAdvertising:advertise];
Then, my other centratl app will scan and filter by the same serviceUUID.
[self.manager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:uuidA] options:@{CBCentralManagerScanOptionAllowDuplicatesKey: @(true)}];
Now, we want to change the ServiceUUID (uuidA -> uuidB), but we hope that the old version of the central app can still scan for the new peripheral app, so I need do multi-advertisement of BLE.
// 1
NSDictionary *advertise = @{CBAdvertisementDataLocalNameKey : shortName, CBAdvertisementDataServiceUUIDsKey: @[[CBUUID UUIDWithString:uuidA], [CBUUID UUIDWithString:uuidB]]};
[self.manager startAdvertising:advertise];
// 2
NSDictionary *advertise = @{CBAdvertisementDataLocalNameKey : shortName, CBAdvertisementDataServiceUUIDsKey: @[[CBUUID UUIDWithString:uuidA]]};
[self.manager startAdvertising:advertise];
NSDictionary *advertise = @{CBAdvertisementDataLocalNameKey : shortName, CBAdvertisementDataServiceUUIDsKey: @[[CBUUID UUIDWithString:uuidB]]};
[self.manager2 startAdvertising:advertise];
However, these two implementations, on the central side, it can always scan only one broadcast packet.
Can somebody suggest any method to do this task? From the central (scanner) app, I should get two different advertisements.
Hi All,When I submitted the .ipa, I was prompted with an error, the information is as follows:Dear Developer,We identified one or more issues with a recent delivery for your app, "xxxxx, Please correct the following issues, then upload again.ITMS-90678: Invalid File Permissions - You must have read and write permissions to the file at /SwiftSupport/iphoneos/libswiftAVFoundation.dylib.ITMS-90678: Invalid File Permissions - You must have read and write permissions to the file at /SwiftSupport/iphoneos/libswiftCore.dylib.ITMS-90678: Invalid File Permissions - You must have read and write permissions to the file at /SwiftSupport/iphoneos/libswiftCoreAudio.dylib.ITMS-90678: Invalid File Permissions - You must have read and write permissions to the file at /SwiftSupport/iphoneos/libswiftCoreData.dylib.ITMS-90678: Invalid File Permissions - You must have read and write permissions to the file at /SwiftSupport/iphoneos/libswiftCoreFoundation.dylib.ITMS-90678: Invalid File Permissions - You must have read and write permissions to the file at /SwiftSupport/iphoneos/libswiftCoreGraphics.dylib.....How should I solve this problem? Hope to hear from you guys.Thanks!