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!
Extensions
RSS for tagGive users access to your app's functionality and content throughout iOS and macOS using extensions.
Posts under Extensions tag
200 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello,
I've developed a macOS app with an AutoFill Credential Provider extension that functions as a passkey provider. In the registration flow, I want my app to appear as a passkey provider only when specific conditions are met.
Is there a way to inspect the request from the web before the passkey provider selection list is displayed to the user, determine whether my app can handle it, and then use that result to instruct the OS on whether to include my app in the passkey provider selection list?
Alternatively, is there a way to predefine conditions that must be met before my app is offered as a passkey provider in the selection list?
Thanks!
Topic:
Privacy & Security
SubTopic:
General
Tags:
Extensions
Autofill
Authentication Services
Passkeys in iCloud Keychain
I'm trying to update an app of mine to have a more modern look, and the last part of it is the Action Extension in Safari.
My info.plist file has the correct NSExtension details to use a storyboard, but storyboards look so old and I'd like to use a nicer SwiftUI-based look. Is this even possible?
This is the relevant bit from the Info.plist:
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
<integer>1</integer>
</dict>
<key>NSExtensionJavaScriptPreprocessingFile</key>
<string>GetURL</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.ui-services</string>
<key>NSExtensionActionWantsFullScreenPresentation</key>
<false/>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
</dict>
I see I can use NSExtensionPrincipalClass instead of NSExtensionMainStoryboard but then I get stuck.
If I remove this:
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
and replace it with this:
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).ActionViewController</string>
I get this error when I run the extension:
Rejecting view controller creation request due to invalid extension storyboard or principal class: Error Domain=NSCocoaErrorDomain Code=967223 "(null)" UserInfo={Invalid Configuration=Either NSExtensionMainStoryboard or NSExtensionPrincipalClass must be specified in the extension's Info.plist file but not both.}
According to that error the two keys are mutually-exclusive, which is fine as I'm using just one of them, so why do I get this error?
Is it something to do with the actual code in ActionViewController?
I have this, and nothing here ever runs:
class ActionViewController: UIViewController {
var theUrl: String = ""
@objc override func viewDidLoad() {
super.viewDidLoad()
if let inputItem = extensionContext!.inputItems.first as? NSExtensionItem {
if let itemProvider = inputItem.attachments?.first {
itemProvider.loadItem(forTypeIdentifier: UTType.propertyList.identifier as String) { [unowned self] (dict, error) in
let itemDictionary = dict as! NSDictionary
let javaScriptValues = itemDictionary[NSExtensionJavaScriptPreprocessingResultsKey] as! NSDictionary
self.theUrl = javaScriptValues["URL"] as! String
// Build the SwiftUI view, wrap it in a UIHostingController then send to the main thread to update the UI
let contentView = ActionExtensionView(theUrl: self.theUrl, clickedCancel: self.cancel, clickedDone: self.done)
let childView = UIHostingController(rootView: contentView)
self.view.addSubview(childView.view)
// Set the place where your view will be displayed
let constraints = [
childView.view.topAnchor.constraint(equalTo: view.topAnchor),
childView.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
childView.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
childView.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
childView.view.widthAnchor.constraint(equalTo: view.widthAnchor),
childView.view.heightAnchor.constraint(equalTo: view.heightAnchor)
]
childView.view.translatesAutoresizingMaskIntoConstraints = false
view.addConstraints(constraints)
DispatchQueue.main.async {
self.present(childView, animated: true)
}
}
}
}
}
Apple really don't make it easy to develop for their platforms, do they?
I have a Logitech Yeti GX microphone, which is working, but i am unable to fully use all its features because of a driver issue. Logitech states the following to resolve "The program Logitech G Hub Driver installer tried to load a new driver extension. To enable this extension, open Systems Settings>General>Login Items & Extensions>Logitech G Hub HID Driver Extension> Toggle on.... that appears to be simple enough... only problem is that Driver Extension doesnt exist as an option for me. Any thoughts as to why not? Thanks for your help.
Hi,
I'm implementing a Message Filter Extension and need clarification about the ILMessageFilterExtensionNetworkURL Info.plist key.
Is it valid to include query parameters in the URL like:
https://example.com/test?id=123
I want to make sure this approach will pass App Review before implementing it. The query parameter would be used to identify the client making the filtering request.
Has anyone successfully used URLs with query parameters in their approved Message Filter Extensions? Any insights would be appreciated.
Thanks!
Hi,
I would like to confirm if the matchDomains property in NERelayManager operates exclusively at the application layer. Specifically, it seems that adding IPv4 addresses or IPv4 CIDR blocks to the matchDomains list does not work, as the relay manager appears unable to match them.
Relay Configuration
For example, I tried adding the following IPv4 patterns to the matchDomains list:
11.22.33.44
11.22..
11.22.*
In this configuration, I expected traffic to be routed to the relay server as defined by the matchDomains entries. However, the relay manager did not handle these IPv4 patterns as anticipated.
On the other hand, when using only the excludedDomains property, the desired IPv4 traffic is successfully routed to the relay server as expected.
Purpose of Forwarding IPv4 to the Relay Server
The primary reason for forwarding IPv4 traffic to the relay server is to address cases where certain applications—such as those developed with Flutter or React Native—use their own custom network stack. These custom network stacks often do not respect the relay configuration. As a result, even when these applications use domains that are matched by the relay manager’s matchDomains, their TCP connections to DNS-resolved IPv4 addresses bypass the relay server and connect directly to the IPv4 server.
This behavior makes it critical to enable IPv4 matching to ensure all traffic, regardless of the application’s network stack implementation, is routed through the relay server.
Questions
Can IPv4 addresses or IPv4 CIDR blocks be used with matchDomains?
If not, is there an alternative method to enable IPv4 matching while keeping matchDomains enabled?
Thank you for your assistance.
Topic:
App & System Services
SubTopic:
Networking
Tags:
Extensions
Network Extension
Network
System Configuration
I would like to create a MailKit extension that will allow me to manage my existing messages. I would like to move them around form folder to folder and reqad and update their headers to store some metadata that will be used by the extension.
Looking at the documentation for MailKit suggests that I can only implement 4 types of handlers (content blocker, action handler, compose handler and security handler). I can’t see anything in the docs about being able to get a list of messages in the inbox and manipulate them.
Am I missing something?
I’d love to hear from someone who knows more about this topic before I get into a dead-end rabbit hole.
cheers,
-tomek
I'm building a share extension for my app when I noticed something weird.
When I open a mobile URL (URLs with "m." like m.randomsite.org) on iOS using a browser (I'm using Safari & Chrome) and then try to share it, what will be share is the URL without the "m." (i.e. randomsite.org)
This messes up with my app since I'm not getting the real URL that I'm viewing using the browser.
I don't think it has something to do with my app since even selecting "Copy" when sharing will result in the altered URL too.
So far this is happening on both iOS 17 and 18. Does someone know whether this is a bug from iOS or not? I don't think this is a Safari bug since I noticed the same thing on Chrome as well
Several users have reported that my iOS Action and Share Extensions is not visible.
Now one of the TestFlight users has reported the same. Notice this user has been using the app for one year, so they know how to use it.
Doing FaceTime and them sharing the screen, we have tried:
Deleting app and downloading from App Store
Deleting app, turning device off (call was off) and turning it on, downloading from App Store
Deleting app, turning device off (call was off) and turning it on, downloading from TestFlight
They can open the app, they just do not see the extensions. I would have thought it was the activation rules inside of the InfoPlist, but they are the same for all users and my other testers are not facing the issue.
Device is iPhone 16 Pro, iOS 18.1
What other steps could I follow? What other information could I gather to fix this?
How to execute code on main app when interacted with a live activity, given that they are already interactable.
is there a way without opening the app?
what are the best ways?
Topic:
App & System Services
SubTopic:
Processes & Concurrency
Tags:
Extensions
WidgetKit
ActivityKit
I am trying to return a SceneView from a DeviceActivityReport. I have my DeviceActivityReportExtension correctly set up and I am able to display a view with text or other UI elements in it, but attempting to return a SceneView as part of the body just won't display. I have this example. When I display this SceneView in my main app, it displays correctly. When I put the same code inside the DeviceActivityReportExtension, the scene does not show up and an error failed to create a gl context appears repeatedly in the console. I'm pretty stumped and would appreciate any suggestions.
import SwiftUI
import SceneKit
struct TestScene: View {
var scene: SCNScene? {
SCNScene(named: "art.scnassets/environment.scn")
}
var cameraNode: SCNNode? {
let cameraNode = SCNNode()
cameraNode.camera = SCNCamera()
cameraNode.position = SCNVector3(x: 0, y: 0, z: 2)
return cameraNode
}
var body: some View {
SceneView(
scene: scene,
pointOfView: cameraNode,
options: [
.allowsCameraControl,
.autoenablesDefaultLighting,
.temporalAntialiasingEnabled
]
)
}
}
Hello,
I am facing a problem when trying to start the Wallet Extension Flow. It seems that even though the
override func status(completion: @escaping (PKIssuerProvisioningExtensionStatus) -> Void)
of the PKIssuerProvisioningExtensionHandler is called, the
override func passEntries(completion: @escaping ([PKIssuerProvisioningExtensionPassEntry]) -> Void)
is not called.
Note that this issue is reproduced in a device with iOS 18.1 whereas it is working correctly in a device with iOS 17.4.
Has something changed regarding the Wallet Extension in iOS 18.1 and above?
We're seeing some new and odd behavior where our NEPacketTunnelProvider instance is receiving a stopTunnelWithReason:completionHandler: call with reason NEProviderStopReasonInternalError.
Can anyone shed some light into how to diagnose this situation?
Here are some basic details:
Our PacketTunnel has been in use for years and we only started seeing this issue recently.
We're able to reproduce this behavior with some light browsing.
The documentation provides no insight on why/when this might occur. Can anyone shed some light into how to diagnose this situation?
Things we’ve tried so far:
We grabbed a sysdiagnose and looked through the logs:
a. Right before the stopTunnel, we see log items referring to a "nesessionmanager" (PID 2038) getting killed. Presumably, this is due to hitting a highwater threshold. (See sysdiagnose items listing below)
b. Thinking these were due to memory pressure, we added logging of available/used memory.
c. We confirmed that the PacketTunnel was only using 11,808.73 KB.
d. Since, there is plenty of memory available the PacketTunnel was not killed for using too much memeory.
We wondered if this could be due to our UI's usage of objects like: NETunnelProviderManager and NETunnelProviderSession
a. We ran an experiment where we swiped closed the UI to ensure these manager/session objects are not used.
b. Without the UI, we still saw the random stopTunnel with NEProviderStopReasonInternalError.
We wondered if our routes were the problem, but they seem correct.
a. See the NEPacketTunnelNetworkSettings listing below
LISTING: From the system_logs.logarchive, the nesessionmanager log items:
2025-01-23 15:07:59.176146 -0800 0x278 memorystatus com.apple.xnu memorystatus: killing process 2038 [nesessionmanager] in high band ? (140) - memorystatus_available_pages: 18932 default kernel
2025-01-23 15:07:59.179641 -0800 0x278 memorystatus com.apple.xnu memorystatus: killing_highwater_process pid 2038 [nesessionmanager] (highwater 140) 7056KB - memorystatus_available_pages: 19161 compressor_size:69593 default kernel
2025-01-23 15:07:59.179888 -0800 0x278 memorystatus com.apple.xnu memorystatus: failed to kill a process and no memory was reclaimed default kernel
2025-01-23 15:07:59.185695 -0800 1 0x45e0c user/501/com.apple.nesessionmanager [2038] exited with exit reason (namespace: 1 code: 0x2) - JETSAM_REASON_MEMORY_HIGHWATER, ran for 266329ms default launchd
2025-01-23 15:07:59.231188 -0800 31 0x45bf2 com.apple.networkextension nesessionmanager(2038) exited default UserEventAgent
2025-01-23 15:07:59.253371 -0800 31 0x45bf2 com.apple.networkextension nesessionmanager exited with active sessions, re-launching nesessionmanager to clear agent status default UserEventAgent
LISTING: From the system_logs.logarchive, the stopTunnel from PID 2046
2025-01-23 15:07:59.201581 -0800 SamplePacketTunnel [Extension com.REDACTED.PacketTunnel]: Calling stopTunnelWithReason because: None
2025-01-23 15:08:20.783112 -0800 SamplePacketTunnel 2025-01-23 15:08:20,786 2046 ERROR REDACTED (285805) - Exiting after waiting for stopTunnelWithReason
LISTING: routes from NEPacketTunnelNetworkSettings
{
tunnelRemoteAddress = fd12:3456:789a:1::1
DNSSettings = {
protocol = cleartext
server = (
2606:4700:4700::1234,
2606:4700:4700::2345,
)
matchDomains = (
,
)
matchDomainsNoSearch = NO
}
IPv6Settings = {
configMethod = manual
addresses = (
fd12:3456:789a:1::1,
)
networkPrefixLengths = (
64,
)
includedRoutes = (
{
destinationAddress = 2606:4700:4700::2345
destinationNetworkPrefixLength = 128
},
{
destinationAddress = 2606:4700:4700::1234
destinationNetworkPrefixLength = 128
},
)
excludedRoutes = (
{
destinationAddress = REDACTED
destinationNetworkPrefixLength = 128
},
{
destinationAddress = REDACTED
destinationNetworkPrefixLength = 128
},
)
}
MTU = 3072
}
Thanks for taking a look, any help or suggestions would be greatly appreciated
I wanted to ask if I can use Camera Capture Extension with AVMultiCamPiP, because the LockedCameraCaptureUIScene only return in the closure one session and I can't use the same session for both the front and back at the same time
Hi,
I would like to confirm whether the matchDomains property in NERelayManager operates strictly at the Application Layer. Specifically, it seems that adding IPv4 addresses or IPv4 CIDR blocks to the matchDomains list does not work, as the relay manager appears unable to match them.
For example, I tried adding the following IPv4 patterns to the matchDomains list:
11.22.33.44
11.22..
11.22.*
However, these IPv4 addresses or patterns are not routed through my Relay server.
Additionally, I have observed that when using only the excludedDomains property, the desired IPv4 traffic is correctly routed to the relay server as expected.
My question is: Can IPv4 addresses or IPv4 CIDR ranges work with matchDomains? If not, is there an alternative approach to enable IPv4 matching while matchDomains is active?
Topic:
App & System Services
SubTopic:
Networking
Tags:
Extensions
Network Extension
Network
System Configuration
Or is it not possible? My idea is a program that can disable low power mode, change my display type to apple XDR, and set my refresh rate to ProMotion (120)
I've developed a new Quicklook data-based preview extension for a custom file type that generates an image preview of the file. I previously used a Quick Look generator plug-in but support for it was deprecated and now removed in macOS Sequoia.
My app opens files using a
open(url.path, O_RDWR | O_NONBLOCK | O_EXLOCK)
call. The locking flags are used to prevent other clients from writing the file if it's already open.
I discovered that when Finder is showing the “large” file previews (such as when in column or gallery modes) from a SMB share, the open call fails with EWOULDBLOCK as if the file is locked.
It does work just fine on local files. Opening with O_SHLOCK also has the issue. Surprisingly it does work just fine for previews that return Plain Text data instead of Image data.
Using the lsof command, it seems like the Quicklook process has some kind of lock on the file.
This is the output of the lsof command:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE
QuickLook 48487 XXXX txt REG 1,15 125000611 3161369
Attached is a test project that tries a few different opening and locking functions. It also includes a test file and a sample image preview extension that displays a red square.
When everything is working, regular console messages show the progress of the tests. When the file is on a SMB share and selected in Finder Gallery mode, the open test will fail with a fault message in the console.
Notably, locking with flock works, which is weird because it should have similar semantics according to the man page for open(2).
Filed this as FB15051186
Topic:
App & System Services
SubTopic:
General
Tags:
Extensions
QuickLook
QuickLook Thumbnailing
Files and Storage
I am implementing a new Intents UI Extension and am noticing that the viewWillDisappear, viewDidDisappear, and deinit methods are not being called on my UIViewController that implements INUIHostedViewControlling, when pressing the "Done" button and dismissing the UIViewController.
This causes the memory for the UI Extension to slowly increase each time I re-run the UI Extension until it reaches the 120MB limit and crashes.
Any ideas as to what's going on here and how to solve this issue?
After investing more than a week into getting a bunch of audio unit projects converted into app + appex + framework, they all are now correctly loaded in-process in the demo host app that is part of Xcode's template.
However, Logic Pro adamantly refuses to load them in-process.
Does Logic Pro simply not do that ever, or is there some hint or configuration my plugins need to provide to enable that? If it is unsupported, will it be supported in some future version of Logic?
The entire point of investing that week was performance, which is moot if it is impossible to test the impact of loading in-process in a real-world usage scenario.
I've got some materials in an app's bundle (some info.plist values, and some images in .xcassets files etc.)
If I access them from within an app extension (a notification service extension, notification content extension for example), then it appears to work.
However while running the extensions in the debugger, there were some messages in the console saying the app bundle wasn't loaded.
So despite it working, this message made me wonder if its not a safe practice and it working was luck and/or timing etc. and if the materials should instead be duplicated within the extension bundle and obtained from there instead of accessing them from the app bundle?