Extensions

RSS for tag

Give users access to your app's functionality and content throughout iOS and macOS using extensions.

Posts under Extensions tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

INUIHostedViewControlling ViewController's Life Cycle Events not being Called
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?
1
0
97
5d
Is it safe to access the contents of an app's bundle from within an app extension?
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?
2
0
163
1w
Share extension activation rule for selected text on macOS
I have a share extension in my app, that shall allow users to send CSV files, custom app files, and selected text to my app via the share sheet for importing that data. So, the share extension should activate when the user has selected either: CSV or plain text files Custom UTI app files Text selected in other apps The supported file types have been defined in as a predicate query according to the example in the docs This works all fine on iOS, and the file sharing also works on the Mac. However, on macOS, my app is not shown as a target in the share sheet when the user selects text in other apps and tries to share that text via the context menu. Does macOS need a different configuration to enable a share extension for selected text? This is how my Info.plist of the Mac share extension looks like: ... <plist version="1.0"> <dict> <key>NSExtension</key> <dict> <key>NSExtensionAttributes</key> <dict> <key>NSExtensionActivationRule</key> <string>SUBQUERY ( extensionItems, $extensionItem, SUBQUERY ( $extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.myCompany.myApp.customFormat" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.delimited-values-text" ).@count == $extensionItem.attachments.@count ).@count &gt;= 1</string> </dict> ... </dict> </plist> I know there is a NSExtensionActivationSupportsText but it seems this cannot be combined with a subquery rule. Is there a way to explicitly enable text activation within the subquery rule?
0
0
128
1w
Open an app from the photos share sheet
I'd like to add a share extension to my app (an Action app extension, I think). The extension would appear when users share a photo in the Photos app (and, ideally, Safari). If you tapped my app icon on the share sheet, iOS would pass the photo to my app and switch the user from Photos or Safari to my full app, with the shared photo(s) available for my app to work with. I know this is possible, because Instagram (a third-party app) works exactly like this. If you look at an image in the Photos app, tap Share and then tap Instagram, iOS will background the Photos app, activate the Instagram app and let you edit and post your photo in the main Instagram app. It seems like NSExtensionContext#open(_:completionHandler:) might do this if I add a custom URL to my main app, but the documentation for that says: Each extension point determines whether to support this method, or under which conditions to support this method. In iOS, the Today and iMessage app extension points support this method. That would rule out an Action, Photo Editing or Share extension. But then how does Instagram do this, and how can I achieve the same in my app? I know that it's possible for an Action, Photo Editing or Share extension to open as a mini-app on top of the app providing the content. But coordinating the IPC for that is much, much more work (for my particular app) than just switching the user over to the app, with full access to all the functionality and data that my main app usually has access to.
0
0
176
1w
Content blocker not removing content
I have a content blocker that generally works correctly, but I need to block an element that has certain text in it. For example, <span id="theId">Some text</span> is easy enough to block because I can locate the id and block that, but what if there is no id, or the id is completely random? What if it's just <span>Some text</span>? How do I block that? Let's say this is my only content blocker rule: [ { "action": { "type": "css-display-none", "selector": ":has-text(/Some text/i)" }, "trigger": { "url-filter": ".*" } } ] No errors are seen when the rule is loaded, so it's syntactically correct, it just doesn't block the HTML. I gather this is because :has-text() works on attributes, not contents, so it works on alt, href, aria-label etc. but not on the contents of the element itself. How do I block Some text in my example above? Thanks!
1
1
240
2w
Message Filter Extension and multiple servers
In the documentation for a Message Filter Extension it states: If you have servers that can help your app extension determine how to handle a message, you must add the Associated Domains capability to your Xcode project and specify those domains. (https://developer.apple.com/documentation/sms_and_call_reporting/sms_and_mms_message_filtering/creating_a_message_filter_app_extension) The words servers and domains are in the plural. If it's possible to specify multiple servers/domains for a Message Filter Extension then how is that done? There's no documentation nor reference for that. If multiple domains can be added to the info.plist then what is the iOS behavior in that case? Can the extension supply/change which domain is used at run time?
0
0
133
2w
Rooted iPhone 15 Pro
iOS 18.2 (22C152) My phone is currently on lockdown mode and I have gotten alerts from Experian that my information is on the dark web as well as having to reset all my accounts. However this has not fixed the issue. Even if I hard factory reset settings etc the root makes its way very shortly after, if not immediately. Though I recently got these notifications and purchased the phone in Feb. 2024 the has been an ongoing issue for a few years. I can elaborate if needed. To make it short I have a reinstalled root on my phone. Apple nor Spectrum (who I have my phone with) have been able to assist with this issue. I have been able to clarify this ”hijacking” with the Geek Squad who didn’t want their legal team involved when asking for a report so the PD can do an internal cyber investigation. So, I’ve just lived with it. Let me know what your thoughts to resolve this issue would be before spending thousands to find a resolution on my own. Side note before asked: what I’ve been told may be it’s ”gateway” is via “DNS hijacking” with WiFi or internally hotspot. I can also elaborate if needed-I’m not a web developer, however I do know where this issue stems from whom has their masters in such industry as well as 30 years experience. It’s annoying and inconvenient at this point and I’m looking for clarity, resolution and if no justice for the criminal then liability. thank you! please refrain from saying “APpLe CaNt bE hiJaCked“ ..
1
0
247
3w
Can I ensure location is saved to SwiftData within Share Extension lifetime?
I am writing a SwiftData/SwiftUI app in which the user saves simple records, tagged with their current location. Core Location can take up to 10 seconds to retrieve the current location from its requestLocation() call. I the main app I have wrapped the CLLocationManager calls with async implementations. I kick off a Task when a new record is created, and write the location to my @Model on the main thread when it completes. A realistic use of the share extension doesn't give the task enough time to complete. I can use performExpiringActivity to complete background processing after the share extension closes but this needs to be a synchronous block. Is there some way of using performExpiringActivity when relying on a delegate callback from something like Core Location?
0
0
204
3w
Unable to install an app extension when running it for debugging
I've got an app with several app extensions (call extension, action extension, notification service extension, message filtering extension, notification content extension). If I need to interactively debug these then I can select the scheme and run the extension within Xcode for all of them except for the notification content extension, with that I get an error dialog summary saying: Failed to install the app on the device / The provided item to be installed is not of a type that CoreDevice recognizes. Which when expanded has the blumpf posted below. Why can I not run the notification content extension, when I can run any other type of app extension? Failed to install the app on the device. Domain: com.apple.dt.CoreDeviceError Code: 3002 Failure Reason: The provided item to be installed is not of a type that CoreDevice recognizes. User Info: { DVTErrorCreationDateKey = "2024-12-27 16:39:54 +0000"; IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker; NSURL = "file:///Users/Me/Library/Developer/Xcode/DerivedData/XFinity-celiagrvtevxcagztrguseawvjkl/Build/Products/Debug.Ceq.QA-iphoneos/NotificationContentExtension.appex"; } -- Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : { "device_identifier" = "00008101-00115D623460001E"; "device_isCoreDevice" = 1; "device_model" = "iPhone13,3"; "device_osBuild" = "18.2 (22C152)"; "device_platform" = "com.apple.platform.iphoneos"; "device_thinningType" = "iPhone13,3"; "dvt_coredevice_version" = "397.28"; "dvt_coresimulator_version" = "993.7"; "dvt_mobiledevice_version" = "1759.40.2.100.1"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = arm64; "operation_duration_ms" = 7; "operation_errorCode" = 3002; "operation_errorDomain" = "com.apple.dt.CoreDeviceError"; "operation_errorWorker" = IDEInstallCoreDeviceWorker; "operation_name" = IDERunOperationWorkerGroup; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 1; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.iphoneos"; "param_diag_113575882_enable" = 0; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 0; "param_diag_checker_tpc_enable" = 1; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_guardMalloc_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_mtc_enable" = 0; "param_diag_queueDebugging_enable" = 1; "param_diag_runtimeProfile_generate" = 0; "param_diag_sanitizer_asan_enable" = 0; "param_diag_sanitizer_tsan_enable" = 0; "param_diag_sanitizer_tsan_stopOnIssue" = 0; "param_diag_sanitizer_ubsan_enable" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 1; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 2; "param_launcher_UID" = 2; "param_launcher_allowDeviceSensorReplayData" = 0; "param_launcher_kind" = 0; "param_launcher_style" = 0; "param_launcher_substyle" = 2; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.app-extension"; "param_structuredConsoleMode" = 1; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphoneos18.2"; "sdk_osVersion" = "18.2"; "sdk_variant" = iphoneos; } -- System Information macOS Version 14.7 (Build 23H124) Xcode 16.2 (23507) (Build 16C5032a) Timestamp: 2024-12-27T08:39:54-08:00
1
0
186
2w
Issue with Live CallerID URL Caching
I've been testing the Live CallerID feature using the Apple-provided local server example - live-caller-id-lookup-example. I've been running a local server with tunneling using ngrok for the initial setup. Everything was working perfectly with the following setup: @main final class CallerID: LiveCallerIDLookupProtocol { var context: LiveCallerIDLookupExtensionContext { LiveCallerIDLookupExtensionContext( serviceURL: URL(string: "https://example-tunnel.ngrok.io")!, tokenIssuerURL: URL(string: "https://example-tunnel.ngrok.io")!, userTierToken: Data(base64Encoded: "BBBB")! ) } } However, after I updated the URLs to the production ones, I encountered an issue: @main struct CallerID: LiveCallerIDLookupProtocol { var context: LiveCallerIDLookupExtensionContext { LiveCallerIDLookupExtensionContext( serviceURL: URL(string: "https://example.net/")!, tokenIssuerURL: URL(string: "https://example/issue")!, userTierToken: Data(base64Encoded: "BBBB")! ) } } The problem is that during calls or when updating PIR parameters, the application still attempts to connect to the initial ngrok tunnel URLs instead of using the new production URLs. I can confirm this because the logs on my local server show incoming requests, indicating that the application is still referencing the old ngrok tunnel URLs. Steps I’ve taken to resolve the issue include: Deleting and reinstalling the application. Using reset(forExtensionWithIdentifier:) Unfortunately, these attempts have not been successful. I even extracted the binary of the app and extension to inspect the strings, confirming that the correct production URLs are present. The server was started with the following command: PIRService --hostname 127.0.0.1 service-config.json Could this be some sort of caching bug on the iOS side, or am I missing something?
0
0
181
3w
The app icon is not appearing under the "From Apps on Your iPhone" section in Apple Wallet.
Hello, We are integrating Apple Wallet functionality using the Thales SDK. While we’ve successfully implemented In-App provisioning, we are encountering an issue with the Wallet Extension. I followed the documentation provided here to implement the Apple Wallet Extension: https://developer.dbp.thalescloud.io/docs/d1-developer-portal/ab10ea4059dx1-apple-wallet-extension I’ve implemented everything as per the guide, but I’m still unable to see my app logo in the Wallet Extension under "From Apps on Your iPhone." Could anyone help identify what might be missing or point me in the right direction to resolve this issue. Thanks!
0
0
187
3w
Symbol not found error running Message Filter Extension on iOS 17.6.1 but no problem with iOS 18.2
If I run an app with a Message Filter Extension on a handset with iOS 18.2 then it runs fine, however if I run the exact same app with no changes on a different phone which has iOS 17.6.1 installed then the following error occurs when the extension is enabled within Settings: dyld[631]: Symbol not found: _$sSo40ILMessageFilterCapabilitiesQueryResponseC14IdentityLookupE21promotionalSubActionsSaySo0abI6ActionVGvs
0
0
233
Dec ’24
Apple Wallet extension
I'm implementing Apple wallet extension in an iOS app. Currently following this documentation https://developer.apple.com/documentation/passkit/implementing-wallet-extensions I'm facing challages while testing the extension. Any suggestion how can i test it during developmet. Like if i want to test the storyboard from Wallet UI extension. Any suggestions or helping material would be appriciated.
0
0
185
Dec ’24
Push Notifications after update to 18+ iOS
Dear Apple Engineer, We have problem in the banking application after update iOS to 18, 18.1 or 18.1.1. No notifications appear on the locked screen, even in the notification center. On lower version push notifications apparently correctly. What have we checked so far is: certificates profiles app with push notifications extension and without it usage of setBadgeCount(_:withCompletionHandler:) instead of applicationIconBadgeNumber Our sample payload with encrypted data: { "aps":{ "alert":"Message from Bank", "badge":0, "sound":"default", "mutable-content":1, "category":"" }, "Type":"", "MessageId":"", "Id":"8ebf0c13-83cf-4029-ac13-91d026c3770a", "Media-url":"", "alternativeTitle":"New message", "priority":5, "EncryptedData":"eyJ0eXAiOiJibTplbmMtdjEiLCJhbGciOiJibTppb3MtZWNkaCIsImVuYyI6ImJtOkExMjhHQ00tSVYxNiIsImVuY19raWQiOiI5OUIyN0E4NC1CQzRFLTRGMzQtQjBGNC0yMTcyMEYxQTFEN0EifQ...BDdxycY-ZWPC7BgI_07efVSgjKyGyGVKlcNtZSslWJePrwJkJyIxFBr07XtayB0I2jv6Vc8AdUpdvMJ-daVzkPYMZ7pQA_X0Pg8RPRS2GnPkhyhK3XNkLRMsjG6CkSafYaqSeLMEpdF2Q-QkajvO3ojnRl1C-Bp9FpNbeaCwJXwqjEMKKhggRsKH8zdk7XcYhZX5_hARbBkIFLrCX1Xzyypp_PfZ23v9Pbd8aHmAf7FQdYN6xbfyoL5XEaDrCjGi-up2n1nlcTeEfkXHBunitUzQulmrjo86GJS0ldhF0mEMZ3_t6ObbjeKijYExMeYHxeCe89Yg10TvZI6kP4xizpJijG9cz75X3VI3I4SgeR8BuZRcb5eTQKWWzGW7u6LD1QtV3PWFCtv942CSz62kPPo-dD0248Fqm5HwxZejQSrZKjYQQ87dkzB0q7p2Q_M0z2Y-bRfNRXJl8VaF5X6-2KwLq47zwrQYUIcEHdag3J05X0SzBiImAdbh2zQz074QqEEpoU1F6C89LHKFxAw", "IsSigned":false } What do you need to analyze the problem? Identifiers, sample application? Best regards, Michał iOS Developer.
1
0
287
Dec ’24
Inconsistent Wallet App Behavior with Mocked Data in PKIssuerProvisioningExtensionHandler
We are implementing Apple Pay and Wallet features in our app and using mocked data for testing purposes. Specifically, in the status(completion:) method of PKIssuerProvisioningExtensionHandler, we return: passEntriesAvailable: true, remotePassEntriesAvailable: true, requiresAuthentication: true, In the passEntries(completion:) method, we provide mocked data for our card. The issue is that the app icon inconsistently appears under the "From Apps on Your iPhone" section in the Wallet app. Sometimes it shows up as expected, but other times it does not. On recent occasions, when the app is selected and mocked authorization is paased, the behavior includes a system error 'Cannot Add Card' even though we provided status that indicates that the app has available cards for Wallet. For reference: The app uses two bundle IDs supporting in-app provisioning and PNO Pass Metadata has not been configured yet. Could you help clarify the potential reasons for this inconsistent behavior?
1
1
300
Dec ’24
Swift Testing tests in enum (namespace) extensions are acting strange
Using Xcode 16.1 (16B40). When adding a test suite with tests in an extension to an enum: The tests can be compiled and executed as expected (by clicking the diamond), and e.g. "Reveal in Test Navigator" works as expected. But after the tests have been executed, there is no check or cross diamond icons in the Test Navigator, If I right click the empty diamond in the margin for one of the tests and click "Jump to report", Xcode shows an alert saying "No test found matching the identifier MyEnumNameSpace/SomeTests/example()", which is very strange. Steps to reproduce: Create a new iOS app project using SwiftUI and Swift Testing. Add a file in the app target defining an enum namespace: public enum NamespaceDefinedInSomeApp {} Replace the content of the already created …Tests.swift file with: import Testing @testable import SomeApp // This works as expected: @Suite struct SomeTests { @Test func example() async throws { #expect(true) } } // This compiles and executes but acts strange: extension NamespaceDefinedInSomeApp { @Suite struct SomeTests { @Test func example() async throws { #expect(true) } } } // This compiles and executes but acts strange: enum AnotherNamespace {} extension AnotherNamespace { @Suite struct SomeTests { @Test func example() async throws { #expect(true) } } }
1
1
296
Dec ’24
Removing Cookie HTTP Header via declarativeNetRequest
I'm porting to Safari a Chrome/Firefox Extension that makes use of declarativeNetRequest.updateDynamicRules to remove some HTTP headers from requests to a specific URL. This works mostly fine, except for some headers for which this is not allowed by WebKit, such as the Priority header (which is however served by Safari). An annoying corner-case I found is that of the Cookie header. When trying to remove it from the request by adding the following rule { id: <rule id>, priority: <rule priority>, action: { type: "modifyHeaders", requestHeaders: [{ "header": "Cookie", "operation": "remove" }] }, condition: { urlFilter: <my url>, resourceTypes: ["main_frame", "sub_frame"] } } nothing error is thrown, yet the Cookie header is still being sent. This rule however works for other headers, such as Referer. Changing "Cookie" for "cookie" does not help. Questions: Is there an alternative way of removing the Cookie header from the HTTP request? Is this just a bug in WebKit? Is there any way of removing "unsupported" headers such as Priority? Any help or references are appreciated. Edited: more specific description of the corner-case.
0
0
327
Dec ’24
Finder File Previews lock files on SMB shares
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
8
0
334
5h
Can I tell when my iOS Widget is running on MacOS (when Use IPhone Widgets is on)
I have an iOS Widget that also can load on the Mac when the Use iPhone Widgets setting is turned on on the Mac in Desktop & Dock. I want to use a different url scheme to open video clips from the widget if it is being clicked on iOS or the Mac. I tried using ProcessInfo.processInfo.isiOSAppOnMac but it always thinks it is on iOS. I also tried looking for the user document path to see if it was /var/mobile/ or /Users/. but it always thinks it is /var/mobile. I assume this is as it is not really a catalyst app but a WidgetKit extension from the phone. Is there anyway I can figure out when the widget is running on the mac? Thanks!
5
0
267
Dec ’24