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

All subtopics

Post

Replies

Boosts

Views

Activity

WebKit Framework for watchOS
As part of a university project, we need to be able to display a website on an Apple Watch and log in to a service. Is it possible to get access to the WebKit framework in a watchOS app? We also need to be able to execute JavaScripts in the browser so that the login process works.
2
0
323
Apr ’24
ProxyConfiguration in WKWebView doesn't allow trusting self-signed certificate
I have an HTTP3 relay setup and I'm trying to get WKWebView traffic to use it. The relay has a self-signed certificate for TLS traffic. When using URLSession to make a call, everything works as expected, but in WKWebView, it doesn't. Here is how I setup my ProxyConfiguration let options = NWProtocolTLS.Options() // sample options to trust any certificate for testing sec_protocol_options_set_verify_block(options.securityProtocolOptions, { (sec_protocol_metadata, sec_trust, sec_protocol_verify_complete) in sec_protocol_verify_complete(true) }, DispatchQueue.global()) let relayServer = ProxyConfiguration.RelayHop(http3RelayEndpoint: relayEndpoint, tlsOptions: options) let relayConfig = ProxyConfiguration(relayHops: [relayServer]) I connect that to my webview by simply doing the following: let configuration = WKWebViewConfiguration() configuration.websiteDataStore = WKWebsiteDataStore.nonPersistent() configuration.websiteDataStore.proxyConfigurations = [relayConfig] let webView = WKWebView(frame: .zero, configuration: configuration) The sec_protocol_options_set_verify_block is never called for the WKWebView (it is when I use URLSession) I get the following error in XCode [pageProxyID=7, webPageID=8, PID=73105] WebPageProxy::didFailProvisionalLoadForFrame: frameID=1, isMainFrame=1, domain=NSURLErrorDomain, code=-1202, isMainFrame=1, willInternallyHandleFailure=0 Is there some API I am missing to get the webview to do custom TLS validation with an HTTP3 relay?
1
2
396
Apr ’24
Translucent Toolbar Background Issue in iOS Safari Private Browsing Mode After Enabling Dark Mode and Single Tab Navigation from Safari Settings
hi. I've come across a UI-related bug. It's not a critical issue, but I'm curious whether it's actually a bug or an intended result. Enable "Dark Mode" on your device. Set Safari to "single tab" mode in the settings. Open the iOS browser. Switch to "Private Browsing" mode. When swiping up, the background of the top toolbar (including the status bar) becomes translucent, revealing the content behind it. When I turn on the 'Reduce Transparency' setting, the issue does not occur, and the background content remains hidden as expected. iPhone12 mini / iOS 17.0.1 thx!
0
0
294
Apr ’24
Passkey and Safari
I have registered and created passkey with credentials.create function in apple device with software 17.4.1 in Safari browser. When I clean the cache in safari and try to log in, it force me to register again and after that I had two passkeys on my device. It should be like this ? Why Safari is related to Passkeys ?
2
0
436
Apr ’24
HTML input option datalist tag not working properly in IOS 17.4.1
If I set an input text box connected to a datalist-options, in order to suggest pre-coded values, this is what happens: The text field shows properly. When I start typing, one or more coincident "options" from the datalist are shown at the bottom of the available screen. When one option is selected, the data contained in it is NOT transcript to the input field. The same webtest works fine on Ipad mini w/ios 15. Try this simple code, it doesn't work: <label for="browser">Choose your browser from the list:</label> <input list="browsers" name="browser" id="browser"> <datalist id="browsers"> <option value="Edge"> <option value="Firefox"> <option value="Chrome"> <option value="Opera"> <option value="Safari"> </datalist>
2
2
625
Apr ’24
Safari shows "No Inspectable Applications" while trying to remote debug web app.
Ever since 17.4.1 updates to Safari, we are unable to debug our web applications using Safari. Was working perfectly fine before. Safari shows "No Inspectable Applications" in the Develop -> iPadName menu. We have 3 target iPads (Mini, Air and gen 10) and one iPhone 13 Pro Max, all on iPadOS and iOS 17.4.1, all of them show "No Inspectable Applications" in the menu. iPad Mini and iPhone were both visible fine before the 17.4.1 update. Other devices were already updated automagically to 17.4.1 so we couldn't check the before - after scenario. Safari running on iPad simulator with XCode 15.2 has same behaviour. We tried debugging with latest version of following MacOS: MacOS Sonoma (Macbook Pro M2) MacOS Sonoma (Mac Mini M1) MacOS Ventura (Macbook Pro i9) All of those have same behaviour: "No Inspectable Applications". We tried Safari Tech Preview and iPadOS 17.5 beta 2 and no change. Are we missing something?
3
4
1k
Apr ’24
Safari logs out all my accounts websites.
Hi! I've got a problem with Safari (17.4.1) in Mac OS Sonoma (14.4.1). Safari logs me out in every website I log in: Google websites, Twitter, also all my Wordpress sites... It logs me out after a few minutes. I try to clean safari, empty caches, cookies. I've got private relay disabled and in privacy settings I've *** all settings unchecked...
1
0
324
Apr ’24
API Authentication
I am trying to migrate some of my mapkit code to the Map Server API. My JWT is fine and I can use that within the API Playground just fine. However, when I try to implement a test using PHP and cURL to get my Map token, I receive a 401 Not Authorized Error. My code is below: <?php $URL="https://maps-api.apple.com/v1/token"; $accesstoken = "<MY TOKEN HERE>"; $authorization = 'Authorization: Bearer'.$accesstoken; $headers = []; $ch = curl_init($URL); curl_setopt($ch, CURLOPT_HTTPHEADER, [$authorization]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$headers) { $len = strlen($header); $header = explode(':', $header, 2); if (count($header) < 2) // ignore invalid headers return $len; $headers[strtolower(trim($header[0]))][] = trim($header[1]); return $len; } ); $result=curl_exec($ch); $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //get status code curl_close ($ch); print_r($headers); echo($result); echo($status_code); ?> Now the exact response that I am receiving is: Array ( [date] => Array ( [0] => Thu, 18 Apr 2024 18:32:15 GMT ) [content-type] => Array ( [0] => application/json;charset=utf8 ) [content-length] => Array ( [0] => 51 ) [connection] => Array ( [0] => keep-alive ) [cache-control] => Array ( [0] => max-age=0 ) [x-rid] => Array ( [0] => c9507281-bc32-46ac-be3b-dc59e97e7fed ) [strict-transport-security] => Array ( [0] => max-age=31536000; includeSubDomains; ) ) {"error":{"message":"Not Authorized","details":[]}} 401 Any help getting this to work would be appreciated.
1
0
288
Apr ’24
How to specify "Connection: close" for a request in WKWebView
I would like to specify "Connection: close" for a request that I load in WKWebView - which actually CAN be done by setting the value on the request that is loaded (and it actually works). However, the documentation at https://developer.apple.com/documentation/foundation/nsurlrequest#1776617 states that it shouldn't be used because the URL loading system handles persistent connections for you. So - my question is how can I indicate to the URL Loading System that I do NOT want to use persistent connections for this particular request? Or - am I safe to just set the header even though it's listed as reserved (because - as mentioned - it does work)?
0
0
253
Apr ’24
Camera stops when the path of our SPA changes
I'm not sure if I just missed a recent breaking change, but we are having an issue with the camera in our single page app on iOS 17.4.1 in Safari. We can open the camera and display it to the user using getUserMedia. However, if the path of the site changes at all (for example, the user clicks a button to opens a sidepanel which results in the path in the browser changing) the camera goes black, even if the video element is still being displayed. I can see in the browser that the camera has stopped, and the user has to re-enable it manually by tapping "Start Using Camera". Any idea's what could be going on here?
2
0
560
Apr ’24
wkwebview not loading some resource
On ios15, when loading a page, occasionally all resources under a domain name cannot be loaded. the code like this: <html><head> <title>issue page</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> </style></head> <body><div> <script type="text/javascript" src="https://wx.qq.com/open/js/jweixin-1.6.0.js"></script> <script type="text/javascript" src="https://wap.xxxx.com/static/webapp/common_res/3rd/jquery-3.6.2.min.js"></script> <script type="text/javascript" src="https://statres.ok.com/quickapp/js/qa_router.min.js"></script> <script type="text/javascript" src="https://wap.xxxx.com/static/webapp/common_res/js/utils.min.js"></script> </div></html> This is a simplified page code. The problem is that the page cannot be loaded. Resources under wx.qq.com and statres.ok.com can be loaded, but all resources under wap.xxxx.com fail to be loaded. (Debugging via safari) wkwebview did not call back to didFinishNavigation, and the page load progress was stuck at 0.5. And then it didn't go out of time. It just stayed there. Here are some of the solutions I tried: 1、At first I thought it was a resource problem, but everything worked fine when I copied it to safari. In addition, most of the time in my page is fine, but once this problem occurs, the page will no longer load out until I restart the app. 2、thought is to cache problem, repetition, I added NSURLRequestReloadIgnoringLocalCacheData, also was not used. 3、 I captured the system logs through idevicesyslog and found no obvious anomalies in webkit. 4、When I used wireshark to find the problem, wap.xxxx.com did not even initiate dns requests, as if the browser ignored the resource.(Normally, I caught the dns request for this page) Please help me divergent ideas, thank you!
2
0
504
Apr ’24
WKWebview's language is not applied with App's language setting.
Hello Our app met issue after iOS 17.4 update. Native view works properly with App language setting. But WKWebview's language is set with general OS setting's language. In example, When OS language is Korean and App language is English, Native view is shown with English, but WKWebview is shown with Korean. We found that navigator.language is Korean. This problem has been occurring since iOS 17.4 version. If anyone knows anything about this issue, could you please share?
0
0
316
Apr ’24
WebXR in WKWebView
Hi, I am creating a native application for the Vision Pro. I am looking to integrate a window with WebXR content that can open an immersive space. I am able to do this from Safari and using a SFSafariViewController, however, I would like to use WKWebView inside my native application to do something similar (as this does not open an additional Safari window before allowing WebXR content). It seems in this current version, the WKWebView does not support WebXR? Is this true or is there any additional preferences that I need to add to enable this in this component.
2
0
486
Apr ’24
In iOS17.5 beta, the html code cannot open the camera in WKWebView
in demo ,load index.html into WKWebView, when i click file button, the camera page present and then dismiss quickly ViewController.h @property (nonatomic, strong) WKWebView *wkWebView; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; WKWebViewConfiguration *configuration = [WKWebViewConfiguration new]; self.wkWebView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 400, 300) configuration:configuration]; NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"]; [self.wkWebView loadFileURL:url allowingReadAccessToURL:[[NSBundle mainBundle] bundleURL]]; self.wkWebView.backgroundColor = [UIColor blueColor]; [self.view addSubview:self.wkWebView]; } index. html <html lang="en"> <head> <meta charset="UTF-8"> </head> <body> <div> <label style="font-size: 40px;">open camera</label> <input type="file" accept="image/*" capture="camera" id="file-input" class="file-input"> </div> </body> </html>
3
0
623
Apr ’24
Webview crashes when keyboard pops up in ios17.4.1
appState=foreground 2024-04-10 10:01:12:439,IPHONE_1ND,10.5.80.6000,3,460000000000000|86dmsu7m2t8cs7w,83D44481-559B-4D5D-BC1F-2E643CF08A16,2088512449022223,exception,-,call_write_crash_log_api,-,-,MonitorPoint_Crash,-,apple-iphone,release,-,-,-,-,-,iPhone16 2,17.4.1,WIFI|--,-,10.5.80.6000,ZbsnB/YU+YsDAEHUUPE53+9a,follow_system_zh-Hans-CN,-,-,-,-,-,-,VoiceOver=0^TimeZone=Asia/Shanghai^AppStatus=background^CIP=(null)^AppSession=195C885D-0152-46E8-8E6D-F6D38D5E0A81^appMode=normal^editionId=300003^lowEnd=T^buildNumber=21E236^simC=2,1,00000000-0000-0000-0000-000000000000 Incident Identifier: 795088EB-76F2-460F-A323-9290DEE9B37F CrashReporter Key: Hardware Model: iPhone16 2 Process: AlipayWallet [972] Path: /private/var/containers/Bundle/Application/EAD57E87-932E-4952-9714-C0B852F3A773/AlipayWallet.app/AlipayWallet Identifier: com.alipay.iphoneclient Version: 10.5.80 (10.5.80.6000) Code Type: ARM-64 Parent Process: [1] Date/Time: 2024-04-10 02:00:47 +0000 OS Version: iPhone OS 17.4.1 (21E236) Report Version: 104 Exception Type: SIGBUS Exception Codes: BUS_ADRERR at 0x16b477fe8 Crashed Thread: 0 Thread 0 Crashed: 0 CoreFoundation 0x0000000190fd5aa8 _generationCountFromListOfSources :104 (in CoreFoundation) 1 CoreFoundation 0x0000000190fd389c -[CFPrefsSearchListSource alreadylocked_generationCountFromListOfSources:count:] :80 (in CoreFoundation) 2 CoreFoundation 0x0000000190f7a3fc -[CFPrefsSearchListSource alreadylocked_getDictionary:] :492 (in CoreFoundation) 3 CoreFoundation 0x0000000190f79f68 -[CFPrefsSearchListSource alreadylocked_copyValueForKey:] :172 (in CoreFoundation) 4 CoreFoundation 0x0000000190f79e9c -[CFPrefsSource copyValueForKey:] :52 (in CoreFoundation) 5 CoreFoundation 0x0000000190f79e50 ___76-[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:]_block_invoke :32 (in CoreFoundation) 6 CoreFoundation 0x0000000190fcafb4 ___108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke :392 (in CoreFoundation) 7 CoreFoundation 0x0000000190fcadc4 _normalizeQuintuplet :356 (in CoreFoundation) 8 CoreFoundation 0x0000000190fcac38 -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] :164 (in CoreFoundation) 9 CoreFoundation 0x0000000190fcab38 -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] :156 (in CoreFoundation) 10 CoreFoundation 0x0000000190fca940 __CFPreferencesCopyAppValueWithContainerAndConfiguration :112 (in CoreFoundation) 11 CoreFoundation 0x000000019101a5ec __CFPreferencesGetAppIntegerValueWithContainer :56 (in CoreFoundation) 12 WebKit 0x00000001a651d77c -[WKWebViewConfiguration init] :232 (in WebKit) 13 WebKit 0x00000001a651de28 -[WKWebViewConfiguration copyWithZone:] :48 (in WebKit) 14 WebKit 0x00000001a64e00f8 -[WKWebView configuration] :28 (in WebKit) 15 WebKit 0x00000001a6d93d54 -[WKContentView(WKInteraction) _cascadeInteractionTintColor] :36 (in WebKit) 16 WebKit 0x00000001a6d93f3c -[WKContentView(WKInteraction) _updateTextInputTraitsForInteractionTintColor] :24 (in WebKit) 17 WebKit 0x00000001a6d9d0d0 -[WKContentView(WKInteraction) _updateTextInputTraits:] :1004 (in WebKit) 18 WebKit 0x00000001a6db5de0 -[WKContentView(WKInteraction) extendedTraitsDelegate] :136 (in WebKit) 19 WebKit 0x00000001a6d93a54 -[WKContentView(WKInteraction) insertionPointColor] :48 (in WebKit) 20 UIKitCore 0x000000019338f674 +[UIKBRenderConfig configForAppearance:inputMode:traitEnvironment:] :272 (in UIKitCore) 21 UIKitCore 0x000000019338eb9c -[UIView(UIKB_UIViewExtras) _inheritedRenderConfig] :332 (in UIKitCore) 22 UIKitCore 0x0000000193d32794 -[UICandidateViewController overrideUserInterfaceStyle] :44 (in UIKitCore) 23 UIKitCore 0x00000001939790c4 ___78-[UIViewController _traitCollectionByApplyingLocalOverridesToTraitCollection:]_block_invoke :172 (in UIKitCore) 24 UIKitCore 0x00000001931fbd10 -[UITraitCollection _traitCollectionByModifyingTraitsCopyOnWrite:] :252 (in UIKitCore) 25 UIKitCore 0x0000000193978b08 -[UIViewController _traitCollectionByApplyingLocalOverridesToTraitCollection:] :116 (in UIKitCore) 26 UIKitCore 0x0000000193201c40 -[UIViewController traitCollection] :228 (in UIKitCore) 27 UIKitCore 0x0000000193206a9c __UIGetCurrentFallbackTraitCollection :180 (in UIKitCore) 28 UIKitCore 0x0000000193205568 _UIViewCommonInitWithFrame :548 (in UIKitCore) 29 UIKitCore 0x00000001932052f4 -[UIView initWithFrame:] :132 (in UIKitCore)
3
0
490
Apr ’24