Extensions

RSS for tag

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

Posts under Extensions tag

193 Posts
Sort by:
Post not yet marked as solved
3 Replies
772 Views
We want to debug our web extension on iOS, by default, we can access web extension background page from Desktop Safari -> Top Menu -> Develop -> Web Extension Background Pages This works perfectly for extensions installed on macOS, but how to access the ones installed on iOS/iPadOS?
Posted
by
Post not yet marked as solved
2 Replies
1k Views
I am currently developing a safari web extension on iOS. The following piece of code is executed in the native application when the extension sends a message to the native app using browser.runtime.sendNativeMessage.    func beginRequest(with context: NSExtensionContext) {     let item = context.inputItems[0] as! NSExtensionItem     let message = item.userInfo?[SFExtensionMessageKey]     os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@", message as! CVarArg) //    Message should follow format of: //    { //     type: "Message type", //     payload: "Message Payload" //    } //    In the future we may want to parse the payload differently, but for now it is a string     guard let response = message as? [String : AnyObject] else {       return     }     guard let type = response["type"] as? String else {       return     }     guard let payload = response["payload"] as? String else {       return     }           let res = NSExtensionItem()           if type == "COPY" {       let itemToCopy = [payload]       let pasteboard = UIPasteboard.general       pasteboard.strings = itemToCopy       res.userInfo = [ SFExtensionMessageKey: [ "res": true ] ]     }     context.completeRequest(returningItems: [res], completionHandler: nil) The code works flawlessly in the iOS 15 simulator, however it does not work on the actual device. ( iPod Touch 7th Generation running iOS 15 beta 2 ) There are no errors, it behaves as if it was working as expected. Any help would be greatly appreciated.
Posted
by
Post not yet marked as solved
2 Replies
1k Views
I've downloaded the Fruit Basket demo project to get a better understanding of how to implement a file provider for macOS. From running the program and looking through some of the code, I believe I have a vague notion about what it does, only I'm still unsure about a lot of things. Where can someone find more information about how Fruit Basket is supposed to work and how it can be used?
Posted
by
Post not yet marked as solved
1 Replies
595 Views
Hello, I'm investigating the use of persistent extension to expose certificates and keys to applications. I am investigating on macOS and iOS but I am currently testing on macOS. I'm able to list the exposed certificate. I thought I could restrict the search to my particular token with kSecAttrTokenID (and the ID I provided to addTokenConfiguration(for: ), e.g. the string "COMPANY-macOS-pext"), but it doesn't work. So I tried to list all the tokens available from my app, using the following code adapted from SecurityTool: static func listAllKeychains() {     listKeychains (ofType: SecPreferencesDomain.user)     listKeychains (ofType: SecPreferencesDomain.system)     listKeychains (ofType: SecPreferencesDomain.common)     listKeychains (ofType: SecPreferencesDomain.dynamic)   }     static func listKeychains (ofType type: SecPreferencesDomain) {     var searchList: CFArray?           let status = SecKeychainCopyDomainSearchList(type, &searchList)     if ( status != errSecSuccess) {       logger.debug("error getting Keychains list : \(status).")       return     }     guard let keychains = searchList as? [SecKeychain] else {       logger.debug("Error on retrieved keychains")       return     }           for keychain in keychains {       var pName = Array(repeating: 0 as Int8, count: 1024)       var pLength = UInt32(pName.count)       let oStatus = SecKeychainGetPath(keychain, &pLength, &pName)       if oStatus == errSecSuccess {         let buffer = [UInt8](unsafeBitCast(pName, to: [UInt8].self))         let name: String = String(bytes: buffer, encoding: .ascii) ?? "Unable to get string"         logger.debug("Keychain \(keychain.hashValue) : \(name)")       } else {         logger.debug("Error getting pathname of keychain \(keychain.hashValue)")       }     }   } I just get the user keychain and the system keychain. Am I missing something here ? How can I list the keychain provided by the extension ? Is it possible to restrict a search for the items provided by my extension ? Regards, ++dom
Posted
by
Post not yet marked as solved
0 Replies
344 Views
Hello guys, I am developing an application and the main functionality is that it should be able to filter SMSs based on whether they contain some links or words taken from an API or not.  Apart from message filter extension which is limited related to sending notifications and using system build-in functionalities, is there another way of reading incoming sms messages? Thank you!
Posted
by
Post not yet marked as solved
0 Replies
368 Views
Hi guys, I am working on a message filter extension and I want to save some sensitive data to keychain, but I am facing some problems. This is a piece of code that I found on the internet. import UIKit class KeyChain {     class func save(key: String, data: Data) -> OSStatus {         let query = [             kSecClass as String       : kSecClassGenericPassword as String,             kSecAttrAccount as String : key,             kSecValueData as String   : data ] as [String : Any]         SecItemDelete(query as CFDictionary)         return SecItemAdd(query as CFDictionary, nil)     }     class func load(key: String) -> Data? {         let query = [             kSecClass as String       : kSecClassGenericPassword,             kSecAttrAccount as String : key,             kSecReturnData as String  : kCFBooleanTrue!,             kSecMatchLimit as String  : kSecMatchLimitOne ] as [String : Any]         var dataTypeRef: AnyObject? = nil         let status: OSStatus = SecItemCopyMatching(query as CFDictionary, &dataTypeRef)         if status == noErr {             return dataTypeRef as! Data?         } else {             return nil         }     }     class func createUniqueID() -> String {         let uuid: CFUUID = CFUUIDCreate(nil)         let cfStr: CFString = CFUUIDCreateString(nil, uuid)         let swiftString: String = cfStr as String         return swiftString     } } extension Data {     init<T>(from value: T) {         var value = value         self.init(buffer: UnsafeBufferPointer(start: &value, count: 1))     }     func to<T>(type: T.Type) -> T {         return self.withUnsafeBytes { $0.load(as: T.self) }     } } It works in the ViewController of the containing app, but when I try it in extension I get no results. Is it possible to use keychain into message filter extension? Or should I find another way of storing sensitive data? Thanks.
Posted
by
Post marked as solved
1 Replies
511 Views
Hi, is NSE working on Mac Catalyst? I easily made it work in my iOS target, but am struggling with Catalyst. I checked that the .appex is built and signed with valid profile. But using the same debug scenario (run main app, attach to pid of NSE, send push notification) doesn't seem to trigger the extension. Documentation is a bit confusing, Extensions seem to define NSE for iOS only (but in this document, is Mac tag containing Mac Catalyst?) UNNotificationServiceExtension says it's available for Mac Catalyst 13.0+ I have no clue where to look. Cheers, Jan
Posted
by
Post not yet marked as solved
0 Replies
228 Views
Hello! Several months ago we've released our extension for Safari. Linguix is one of a limited number of writing assistants that Safari users can use to get their writing fixed on millions of websites. Our tool was featured in other extensions stores (CWS, Mozilla), we have great reviews everywhere. However, I could not find any option to discuss the featuring or get in touch with the Safari Extensions store team. So, the question is, are there any options to get our extension reviewed and considered for the promotion within the store? I strongly believe users will be grateful for the new useful tool!
Posted
by
Post not yet marked as solved
5 Replies
3.5k Views
I can not activate AX88179 anymore after I have updated my mac to version 11.5 although On 11.4 Big Sur, everything was still be ok. I also check extensionsctl list on command prompt and it shows as follows: mabook@mabooks-MBP ~ % systemextensionsctl list 2 extension(s) --- com.apple.system_extension.driver_extension enabled active teamID bundleID (version) name [state] 5RHFAZ9D4P com.asix.dext.usbdevice (1.2.0/1.2.0) com.asix.dext.usbdevice [terminating for uninstall but still running] 5RHFAZ9D4P com.asix.dext.usbdevice (1.2.0/1.2.0) com.asix.dext.usbdevice [activated waiting to upgrade on reboot] How should I deal with this problem to connect to Ethernet
Posted
by
Post not yet marked as solved
0 Replies
347 Views
Hello, From this information: https://support.apple.com/fr-fr/guide/deployment-reference-ios/apd05d8c6344/web, I thought that I could use the CoreNFC framework in a persistent extension. Unfortunately, it seems that this is not the case. Any chance to have this framework available for persistent extension ? I opened a request on the feedback assistant (FB9382909) is this the right path to ask for that kind of stuff ? Regards, ++dom
Posted
by
Post not yet marked as solved
0 Replies
393 Views
I have an app on the Mac App Store (so sandboxed) that includes a QuickLook Preview Extension that targets Markdown files. It works just. But I'm in the process of updating it so that it displays inline images as well as styled text. However, despite setting Downloads read-only access permission (and user-selected, though I know that shouldn't be required: no open/save dialogs here) in the extension's entitlements, Sandbox refuses too allow access to the test image: I always get a deny(1) file-read-data error in the log. FWIW, the test file is referenced in the source Markdown as an absolute path. I've tried different signings and no joy. I’ve tried placing the referenced image in various other locations. Also no joy. Question is, is this just something QuickLook extensions cannot do from within the sandbox, or am I missing something? Is there anything extra I can do to debug this?
Posted
by
Post not yet marked as solved
1 Replies
696 Views
Hello, I wanna make my own version of the rainbow brackets extension for Xcode, but using swift. A good example of this extension would be Rainbow Brackets for Intellij. Also, if there is any good tutorial or course about this let me know.
Posted
by
Post not yet marked as solved
0 Replies
341 Views
Hi Folks, I've been banging my head against the wall for days now. I can't seem to get any extension (share or action) to appear when building on a physical device (debug or release or via test flight). The extensions always appear when using the simulator. Simulator is running ios 14.5 and physical device is running 14.6. This is also on xCode 12.5.1 and on Big Sur 11.5.1 Additionally it is a Swift extension. Any help is super appreciated. I don't even know what to do anymore. Feeling like giving up and posting here is my last hope. :(
Posted
by
Post not yet marked as solved
0 Replies
291 Views
I am looking to share data from other application to my application. As a requirement want to share either "public.url", "public.plain-text" or both. To achieve this followed some solution using predicate. Tried with different style like below Case-1 &lt;key&gt;NSExtensionAttributes&lt;/key&gt; &lt;dict&gt; &lt;key&gt;NSExtensionActivationRule&lt;/key&gt; &lt;string&gt;SUBQUERY ( extensionItems, $extensionItem, SUBQUERY ( $extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" ).@count &gt;= 1 ).@count &gt; 0 &lt;/string&gt; &lt;/dict&gt; Case-2 &lt;key&gt;NSExtensionAttributes&lt;/key&gt; &lt;dict&gt; &lt;key&gt;NSExtensionActivationRule&lt;/key&gt; &lt;string&gt;SUBQUERY ( extensionItems, $extensionItem, SUBQUERY ( $extensionItem.attachments, $attachment, ( ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" ) ).@count == 1 ).@count == 1 &lt;/string&gt; &lt;/dict&gt; One observation: with TRUEPREDICATE app icons appear sometime for all app sharing extension view (Modal) use TRUEPREDICATE &lt;key&gt;NSExtensionActivationRule&lt;/key&gt; &lt;string&gt;TRUEPREDICATE&lt;/string&gt; My Bundle setting like : Bundel Id for main App : com.appname.devAppname Share Extension target Bundle Id : com.appname.devAppname.AppnameShareExtension App group group.com.appname.devAppname.AppnameShareExtension can you help in this what I am missing.
Posted
by
Post not yet marked as solved
0 Replies
451 Views
I am trying to implement keychain sharing using KeychainAccess. I have my main app that is suppossed to write a string to a shared keychain and a message filter extension where I want to read the data from the keychain and do some additional computations. I declare everything in a struct as follows: protocol Keychainable { func save(string: String) func get() -> String? } struct KeychainAccessStruct: Keychainable { let keychain = Keychain(service: "app.test", accessGroup: "xxxxx.xxxxx.xxxxx.iFilterKeychain") func save(string: String) { let userData = try! NSKeyedArchiver.archivedData(withRootObject: string, requiringSecureCoding: false) do { try keychain.set(userData, key: "keychain_key") } catch { print(error) } } func get() -> String? { do { let value = try keychain.getData("keychain_key") return try! NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(value!) as! String } catch { print(error) } return nil } } In the main app, when I try to save a string, I call: let keychain = KeychainAccessStruct() keychain.save(string: "STRING TO SAVE") Then, in the app extension, when I try to read the string, I call: let keychain = KeychainAccessStruct() print(keychain.get()) The problem is that, when I run the extension, I receive the following error when trying to read from the keychain: OSStatus error:[-25291] No keychain is available. You may need to restart your computer. Also, if I try to retrieve the string from the keychain in the main app it's working fine, it looks like the problem only happens in the message filtering extension. I have looked over this question and it looks like I have all the setup just fine (I have included the app ID prefix in the method instantiation and the entitlements are included in both the app and the extension). I have also seen this question and, while I have enabled the keychain sharing in capabilities, I seem to not be able to find what RequestsOpenAccess refers to (although it's an older answer so maybe some things have changed?). I am fairly new to swift and xcode in general so I am not certain what exactly I am missing. Can anyone help or point me in the right direction?
Posted
by