I am developing an WKWebView app that runs on both mobile and mac platforms using a react website. Currently, an admin user can send a call request in which the user gets a pop-up to answer. on iOS it works as intended, the user is asked to grant permission to utilize camera and microphone and the user is immediately connected upon accepting, however I never receive the pop-up when running in Mac Catalyst. I have ensured to enable permissions in sandbox settings as well as adding NSCamera and NSMic permissions in the property list. in the safari debugging console I receive this error upon clicking the accept call
ReferenceError: Can't find variable: RTCPeerConnection
Ive attempted to use the webview callback requestMediaCapturePermissionFor, and this did not seem to trigger on attempting to answer the call. Is this an error on my development end? or is this an issue I should look to the react code for a fix. I appreciate any feedback possible. Thanks.
Post
Replies
Boosts
Views
Activity
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.
I have an webview that loads videos in it, we would like to be able to fullscreen our videos, so we use the fullscreen preference in the documentation however when it is set to true, upon fullscreening a video then pausing it, the entire video player will disappear.
You can exit fullscreen and attempt to fullscreen the video player once again, however upon doing this the entire app view will now disappear and you'll see your desktop background (or whatever is currently behind your app). This behavior seems consistent across multiple websites with the current app. I have setup a sample project you can test here
The Main error that seems to trigger to the console is this. I have not been able to find a solution to, maybe I am simply missing something here. I am on Sequoia 15.2 for Mac.
Attempting to update all DD element frames, but the bounds or contentsRect are invalid. Bounds: X: 0.00 Y: 0.00, W: 0.00 H: 0.00, contentsRect: X: 0.00 Y: 0.00, W: 1.00 H: 1.00 , skipping