Explore the integration of web technologies within your app. Discuss building web-based apps, leveraging Safari functionalities, and integrating with web services.

General Documentation

Posts under General subtopic

Post

Replies

Boosts

Views

Activity

iOS18 WKWebView URLProtocol
In our project, URLProtocol is used to intercept the request of WKWebView.loadRequest. On iOS18, if the APP is idle for more than 10 minutes and then clicks on an H5 page, the time from WKWebView.loadRequest -> URLProtocol.canInitWithRequest will be as long as 600ms or more, but the second time the H5 page is opened, it will only be 80ms. This only occurs on iOS18 models.
2
0
716
Nov ’24
JavaScriptCore crash
There is something wrong with WKWebView. it crash. that: - (void)viewDidLoad { [super viewDidLoad]; [self.wkwebView evaluateJavaScript:@"navigator.userAgent" completionHandler:^(id _Nullable result, NSError * _Nullable error) { }]; } crash info ------------------------------------- Translated Report (Full Report Below) ------------------------------------- Incident Identifier: 2430792E-CF51-4EF1-94CF-EC72AC601B2C CrashReporter Key: 50bcb858d8f2af8c94fc75188b8a740c78e148ff Hardware Model: iPhone11,6 Process: Youkui4Phone [956] Path: /private/var/containers/Bundle/Application/198201AE-A0DE-4E8F-B84A-2209122A5783/Youkui4Phone.app/Youkui4Phone Identifier: com.youku.YouKu.InHouse Version: 11.1.13.8339 (2042174090) Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Coalition: com.youku.YouKu.InHouse [600] Date/Time: 2024-12-17 16:11:51.5863 +0800 Launch Time: 2024-12-17 15:47:19.4488 +0800 OS Version: iPhone OS 18.1.1 (22B91) Release Type: User Baseband Version: 7.00.00 Report Version: 104 Exception Type: EXC_CRASH (SIGKILL) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: FRONTBOARD 2343432205 <RBSTerminateContext| domain:10 code:0x8BADF00D explanation:scene-update watchdog transgression: app<com.youku.YouKu.InHouse(EEEC9FA9-AFA2-4648-B178-EFFB7C9FE91D)>:956 exhausted real (wall clock) time allowance of 10.00 seconds ProcessVisibility: Foreground ProcessState: Running WatchdogEvent: scene-update WatchdogVisibility: Foreground WatchdogCPUStatistics: ( "Elapsed total CPU time (seconds): 13.120 (user 13.120, system 0.000), 22% CPU", "Elapsed application CPU time (seconds): 2.732, 4% CPU" ) reportType:CrashLog maxTerminationResistance:Interactive> Triggered by Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_kernel.dylib 0x1e503ff90 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x21d17aa50 _pthread_cond_wait + 1204 2 JavaScriptCore 0x1ab495ce8 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 1900 3 JavaScriptCore 0x1ab4852e4 WTF::LockAlgorithm<unsigned char, (unsigned char)1, (unsigned char)2, WTF::EmptyLockHooks<unsigned char>>::lockSlow(WTF::Atomic<unsigned char>&) + 216 4 JavaScriptCore 0x1ac413cc0 JSC::JSLock::lock() + 568 5 JavaScriptCore 0x1ac45d0f0 JSC::JSRunLoopTimer::Manager::timerDidFireCallback() + 808 6 JavaScriptCore 0x1ab49e218 WTF::RunLoop::TimerBase::start(WTF::Seconds, bool)::$_0::__invoke(__CFRunLoopTimer*, void*) + 96 7 CoreFoundation 0x194cda894 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32 8 CoreFoundation 0x194cda538 __CFRunLoopDoTimer + 1012 9 CoreFoundation 0x194cda08c __CFRunLoopDoTimers + 288 10 CoreFoundation 0x194c793b4 __CFRunLoopRun + 1856 11 CoreFoundation 0x194c78830 CFRunLoopRunSpecific + 588 12 GraphicsServices 0x1e0c581c4 GSEventRunModal + 164 13 UIKitCore 0x1977deeb0 -[UIApplication _run] + 816 14 UIKitCore 0x19788d5b4 UIApplicationMain + 340 15 Youkui4Phone 0x105160fcc main + 56 16 dyld 0x1ba666ec8 start + 2724
Topic: Safari & Web SubTopic: General
1
0
389
Dec ’24
Throttling on navigator.geolocation.getCurrentPosition on Safari
I'm using navigator.geolocation.getCurrentPosition to retrieve the users coordinates in a PWA built with Nextjs. getCurrentPosition is called by clicking on a button. If getCurrentPosition is called afterwards, the cached value is returned. On Safari, If I refresh the page, or logout, login and call getCurrentPosition again, the getCurrentPosition error callback is called with an error code 2 - POSITION_UNAVAILABLE. After around five minutes, getCurrentPosition can be called again. Is there some kind of throttling restriction on Safari navigator.geolocation.getCurrentPosition?
0
0
417
Jan ’25
FaceTime camera returns promise before solving it
The strange_behaviour.mp4 video attached shows how when running a list of statements to open (startCamera) and close (closeCamera) the camera against a MacBook Pro 2019 using the FaceTime camera, these return their value almost immediately, when in reality the camera is still opening and closing. We believe that there might be a queue for statements to run against the camera and it finishes the awaits when all the statements are inserted in the queue instead of when they are actually solved. We also attached the expected_behaviour.mp4 video where we replicate the same flow but using an external camera instead of the FaceTime camera. In this video, the promises take a bit longer to return but they do once the camera has already been opened and closed the requested amount of times. The project used in the videos is attached as project.tar.xz. We would like to know if the behaviour in strange_behaviour.mp4 is replicable on your side and if there is a way to access the cameras to make it behave like when using an external camera (expected_behaviour.mp4). Attachments: https://drive.google.com/drive/folders/1cOeFb5GMbh4mPOeZiZyyevk3N778Kn1M?usp=sharing
0
0
462
Nov ’24
Issue with iOS Safari Handling Updates in .ics Files
I have an endpoint that generates a .ics file. From my mobile app, I open the browser (Safari) and retrieve the .ics file. In Safari, the events are displayed as expected, and I can use the "Add All" button to add them to the calendar. After clicking "Add All," I can select the desired calendar, and the events are successfully added (see screenshots 1 and 2 below). Here’s the initial .ics file response: BEGIN:VCALENDAR VERSION:2.0 CALSCALE:GREGORIAN PRODID:NAME BEGIN:VEVENT DTSTAMP:20250101T195917Z DTSTART:20250102T131600 DTEND:20250102T142500 SUMMARY:My Event 1 UID:unique-uid1 LAST-MODIFIED:20250101T155715Z DESCRIPTION:Description SEQUENCE:1 END:VEVENT BEGIN:VEVENT DTSTAMP:20250101T195917Z DTSTART:20250103T131600 DTEND:20250103T135600 SUMMARY:My Event 2 UID:unique-uid2 LAST-MODIFIED:20250101T155715Z DESCRIPTION:Description SEQUENCE:1 END:VEVENT END:VCALENDAR Later, I updated the .ics file with new event details: BEGIN:VCALENDAR VERSION:2.0 CALSCALE:GREGORIAN PRODID:NAME BEGIN:VEVENT DTSTAMP:20250102T195917Z DTSTART:20250104T131600 DTEND:20250104T142500 SUMMARY:My Event 1 Update UID:unique-uid1 LAST-MODIFIED:20250104T155715Z DESCRIPTION:Description SEQUENCE:2 END:VEVENT BEGIN:VEVENT DTSTAMP:20250102T195917Z DTSTART:20250105T131600 DTEND:20250105T142500 SUMMARY:My Event 2 Update UID:unique-uid2 LAST-MODIFIED:20250102T155715Z DESCRIPTION:Description SEQUENCE:2 END:VEVENT END:VCALENDAR I updated everything according to the iCalendar documentation: UID remained unchanged SEQUENCE has been updated DTSTAMP has been updated LAST-MODIFIED has been updated However it seems like that Safari can't handle updates on events. In the preview we can see the changes, but when I click on "Add All" button, nothing happens. The same behavior is working with other calendars like Outlook (web view) or Google Calendar. My Questions: Is there a property missing from my .ics file that is necessary for iOS Safari to handle updates? Is Safari not designed to handle event updates in this way? Should I consider moving to a subscription-based solution to manage updates more reliably? Any insights or suggestions would be greatly appreciated!
0
0
600
Jan ’25
After set video.src, video.play() not work
Iphone 16 pro After set video.src, video.play() not work <div> <button id="play"> play </button> </div> <video id="video" preload="auto" playsInline webkit-playsinline="true" x5-video-player-type="h5" x5-video-player-fullscreen="true" x5-video-orientation="portraint" x-webkit-airplay="true" raw-controls="true" style="width: 300px;" > <source src="****.mp4" type="video/mp4" /> <track kind="captions" srcLang="en" /> </video> <script> document.querySelector('#play').addEventListener('click', function() { document.querySelector('#video').play(); }) document.querySelector('#video').addEventListener('ended', function() { document.querySelector('#video').pause(); document.querySelector('#video').src = '*****.mp4'; document.querySelector('#video').play() }) </script>
Topic: Safari & Web SubTopic: General Tags:
0
0
377
Nov ’24
How to access shippingContact after transaction?
So I know I can request for an email in the paymentRequest requiredShippingContactFields and could also access minimal information with onshippingcontactselected, but how can I actually get the full shippingContact AFTER a transaction. The documentation doesn't say what API call this is returned with or anything, so please help! Relevant doc: https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypayment/1916097-shippingcontact
Topic: Safari & Web SubTopic: General
0
0
303
Oct ’24
Unable to Launch Safari Driver
I am encountering an issue where we are unable to run or launch Safari Driver in our automation tests using macOS. When attempting to run safaridriver -p 8888 from the terminal, we receive the following error message: ERROR: safaridriver could not launch because it is not configured correctly or you need to authenticate. Re-run safaridriver(1) and pass the '--enable' flag to configure and/or authenticate. For more information, consult the safaridriver(1) man page. Despite running sudo safaridriver --enable as an administrator (even as root), the issue persists. I’ve searched through various online forums and GitHub repositories but couldn’t find a working solution. Some references are: Apple Developer Forum Thread: https://forums.developer.apple.com/forums/thread/762321 GitHub Issue: https://github.com/SeleniumHQ/selenium/issues/11381
Topic: Safari & Web SubTopic: General Tags:
3
0
479
Mar ’25
[MapkitJS] Uncaught TypeError: [MapKit] Expected a number for `x` in MapRect constructor but got `NaN` instead.
Hi, I'm building a nextjs app based on of MapkitJS. I tried to pass a new value to cameraZoomRange like the code below. As long as I put in this part map.cameraZoomRange, the error shows up. Not sure it's my fault, or the bug of MapkitJS. const map = new window.mapkit.Map(element, { colorScheme: mqMatchLightTheme ? window.mapkit.Map.ColorSchemes.Light : window.mapkit.Map.ColorSchemes.Dark, showsCompass: window.mapkit.FeatureVisibility.Hidden, showsMapTypeControl: false, showsZoomControl: false, showsUserLocation: true, tracksUserLocation: true, isRotationEnabled: true, isZoomEnabled: true, }); map.cameraZoomRange = new window.mapkit.CameraZoomRange({ minCameraDistance: 14, maxCameraDistance: Infinity, });
1
0
562
Oct ’24
navigator.mediaDevices.getUserMedia() Report an error
When using WKWebview to load the following html on iOS17.5 Simulator, navigator.mediaDevices.getUserMedia reports an error (A MediaStreamTrack ended due to a capture failure), but the then branch can be executed. The video cannot be loaded. There is no problem with iOS17 Simulator and iOS18 Simulator. Thank you very much for answering the question. <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, viewport-fit=cover"> <title>WebKit Camera Preview</title> </head> <body> <div id="content" style="margin-top:env(safe-area-inset-top);background-color:blue"> <button style="width:200;height:40px;" onclick="doClick()">open camara</button> </div> <video playsinline id="myVideo" ></video> <script> var ggstream = null function doClick(){ const content = document.getElementById("content") content.style.backgroundColor = "red" navigator.mediaDevices.getUserMedia({ video : true}) .then(stream => { const video = document.getElementById('myVideo'); video.srcObject = stream; video.play() }) .catch(err => { console.error('Error accessing media devices.', err); }); } </script> </body> </html>
Topic: Safari & Web SubTopic: General
1
0
494
Dec ’24
Type 65 DNS queries
HI, I'm seeking help on the following: When members of public in Singapore are using iOS 14 and above version to surf gov't websites using Safari, noted that Safari is sending Type 65 DNS queries which had also rendered gov't websites slower as compared to similar chromium browsers. Is there any other workarounds that we can advise the public to adopt?
Topic: Safari & Web SubTopic: General
0
0
335
Nov ’24
LocalStorage sometimes disappears in WKWebView
I am currently publishing an application that uses WebView, I am currently publishing an application that uses WebView, but I am having trouble with data in LocalStorage sometimes disappearing. The website displayed in WebView is made with PHP, By writing the following code in JavaScript, When WKWebView is opened, localStorage is saved and retrieved. window.localStorage.setItem('isAlreadyAgree', true); window.localStorage.getItem('isAlreadyAgree'); The problem is that sometimes this getItem does not get the data. ・This is not reproducible and does not always occur when some process is performed. ・Is it possible that the storage of the application is cleared due to distribution using MDM? ・Is it possible to store too much data in UserDefault, which would cause the LocalStorage space to be overwhelmed and disappear? I would appreciate any hints you can give me. Thank you in advance.
0
0
450
Dec ’24
Integrating Sales Software with Website Payment via Apple Pay
Hi. I have reviewed the process of integrating Apple Pay on the web, but I still don’t understand how to implement it. For example: I currently have software A and a payment website that my software provides to restaurants. So, how can I integrate Apple Pay on the restaurants' payment websites? I read that to integrate, we need to register for a Merchant ID with Apple Pay. So, is it the restaurants or the software provider who should register? Each restaurant will have a different website domain -> does that mean when registering the Merchant ID, the website domain is the payment website of each restaurant? When Apple Pay provides the verification file, the sales software (i.e., the payment website) must help the restaurants upload that file to the payment website of each restaurant, right? To verify if it is valid or not depends on Apple Pay, right? If it is valid, the Apple Pay payment button will be displayed, correct?
0
0
448
Nov ’24
Safari Web Extension service_worker failed to load
I built and extension for chrome, edge, and firefox. I'm porting the chrome extension to safari using the safari-web-extension-converter tool. This has worked successfully and I was able to publish my extension to the app store. I made some updates to the service worker code recently and I'm now being hit with an error when trying to load my unsigned extension into safari: The service_worker script failed to load due to an error. I've looked online at some other forums and haven't found anything helpful around how to debug this kind of error. Because the service worker is non-persistent in safari, I don't have access to the console logs of the service worker through the Develop > Web Extension Background Context menu. Has anyone successfully debugged this kind of error? Are there logs I can pull directly from safari that would help me here? Thanks in advance for the help!
0
0
266
Feb ’25
XSRF-TOKEN can not be set in Safari 17.0 over IPv6
Hi, When we using Safari on MacOS with IPv6 we found that the XSRF-TOKEN can be set into the cookies. We have set-cookie in the authentication response headers 'Set-Cookie: XSRF-TOKEN=*******; SameSite=Strict; Secure'. It works by using Safari with IPv4. And also works with Chrome/FireFox with IPv4/IPv6. And also worked with Safari 15.6.1 over IPv6. May I know if this an issue or by design? Anyone aware of this? Thanks.
0
0
369
Dec ’24