Bluetooth audio becomes choppy on iOS with entitlement error but works just fine on MacCatalyst

I am converting some old objective-C code deployed on ios 12 to swift in a WKWebView app. Im also developing the app for Mac via MacCatalyst. the issue im experiencing relates to a programmable learning bot that is programmed via block coding and the app facilitates the read and writes back and forth. the audio works via a A2DP connection the user sets manually in their settings, while the actual movement of the robot is controlled via a BLE connection. Currently the code works as intended on MacCatalyst, while on iPhone, the audio being sent back to the robot is very choppy and sometimes doesn't play at all. I apologize for the length of this, but there is a bit to unpack here.

First, I know there has been a few threads posted about this issue, this one that seems similar but went unsolved https://forums.developer.apple.com/forums/thread/740354

as well as this one where apple says it is "log noise" https://forums.developer.apple.com/forums/thread/742739

However I just find it hard to believe that this issue seems to be log noise in this case. Mac Catalyst uses a legacy header file for WebKit, and im wondering if that could be part of the issue here.I have enable everything relating to bluetooth in my info plist file as the developer documents say. In my app sandbox for mac catalyst I have the permissions set for bluetooth as well there. Here are snippets of my read and write function

    func readFunction(session: String){
        // Wait if we are still waiting to hear from the robot
        if self.serialRxBuf == ""{
            self.emptyReadCount += 1
        }
        
        
        if (!self.serialRxWaiting){
            return
        }
        
        // Make sure we are waiting for the correct session
        if (Int(session) != self.serialRxSession){
            return
        }
        self.serialRxWaiting = false
        self.serialRxSession += 1
        
        let buf = self.serialRxBuf
        self.serialRxBuf = ""
        print("sending Read: \(buf)")
        self.MainWebView.evaluateJavaScript("""
    if (serialPort.onRead) {
        serialPort.onRead("\(buf)");
        }
        serialPort.onRead = null;
    """
        ,completionHandler: nil)
    }


// ----- Write function for javascript bluetooth interface -----
    func writeFunction(buf: String) -> Bool {
        emptyReadCount = 0
        if((self.blePeripheral == nil) || (self.bleCharacteristic == nil) || self.blePeripheral?.state != .connected){
            print("write result: bad state, peripheral, or connection ")
            // in case we recieve an error that will freeze react side, safely navigate and clear bluetooth information.
            if MainWebView.canGoBack{
                MainWebView.reload()
                showDisconnectedAlert()
                self.centralManager = nil // we will just start over next time
                self.blePeripheral = nil
                self.bleCharacteristic = nil
                self.connectACD2Failed()
                return false
                
            }
            return false
        }
        var data = Data()
        var byteStr = ""
        for i in stride(from: 0, to: buf.count, by: 2) {
            let startIndex = buf.index(buf.startIndex, offsetBy: i)
            let endIndex = buf.index(startIndex, offsetBy: 2)
            byteStr = String(buf[startIndex..<endIndex])
            let byte = UInt8(byteStr, radix: 16)!
            data.append(byte)
        }
            guard let connectedCharacteristic = self.bleCharacteristic else {
                print("write result: Failure to assign bleCharacteristic")
                return false
            }
            print("sending bleWrite: \(String(describing: data))")
            
            self.blePeripheral.writeValue(data, for: connectedCharacteristic, type: .withoutResponse)
            print("write result: True")
            return true
        }

Here is what the log looks like when running on mac catalyst, which works just fine

sending bleWrite: 20 bytes
write result: True
sending Read: 
sending Read: 55AA55AA0B0040469EE6000000000000000000ED
sending bleWrite: 20 bytes
write result: True
sending Read: 
sending Read: 
sending Read: 55AA55AA0B0040469EE6000000000000000000ED
sending bleWrite: 20 bytes
write result: True
sending Read: 55AA55AA0B0040469EE6000000000000000000ED
sending bleWrite: 20 bytes
write result: True
sending Read: 55AA55AA0B0040EDCB09000000000000000000ED
sending bleWrite: 20 bytes
write result: True
sending Read: 
sending Read: 55AA55AA0B00407A7B96000000000000000000ED
sending bleWrite: 20 bytes
write result: True
Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}>
0x12c0380e0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=36540, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}

and here is the log from when we are running the code on iPhone (trying to save space here)

I apologize for the length of this post, however submitting a test project to apple developer support just isn't possible with the device thats in use. Any help at all is appreciated. i've looked at every permission, entitlement, background processing, and tried every solution that I could find to no avail.

Bluetooth audio becomes choppy on iOS with entitlement error but works just fine on MacCatalyst
 
 
Q