Post

Replies

Boosts

Views

Activity

OSStatus error:[-25291] No keychain is available. You may need to restart your computer
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?
0
0
1.1k
Aug ’21
Verify identity of an iPhone user
Hello guys, Me and my team are developing an application which uses some data from an API and we need to verify that we can recognize a single user ID of the iOS phone to establish a univocal trust relation to share keys that would help us encrypt the communications. I tried some pieces on code that I found on internet, but I do not know if this is enough. print("ID Vendor...\(String(describing: uiDevice.identifierForVendor))") print("iCloud token...\(String(describing: FileManager.default.ubiquityIdentityToken?.description))") And also I was trying to work with DeviceCheck framework and to get that token. print("Generate token")                 DCDevice.current.generateToken {                 (data, error) in                 guard let data = data else {                     return                 }                 let token = data.base64EncodedString()                     print("Token...\(token)") What I want to do is to verify the user identity something like the Apple ID or some personal data, not the device information. Is there a way of retrieving some personal data from the owner of the iPhone that I can use to check if he is who said that it is? Thank you so much! Have a good day!
0
0
816
Aug ’21
Use keychain into message filter extension
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.
0
0
541
Jul ’21
Read incoming SMSs
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!
0
0
477
Jul ’21
Make Xcode use an aar file
I'm working on a message filter extension for iOS and I am kind of stuck. I would like to make some verification on message, but the code is written in Java/Android in an aar file. From my research, I tried to place the file into Build Phases -> New Copy Files Phases and place the file there or in Project-> General -> Development Assets, but no change. Also I tried to place the aar file into a folder named libs and implement it using gradle and the build.gradle file, but I get the next warning: " Could not find method compile() /implementation() for arguments [{name= 'placeholder', ext= 'aar'}]" Is there any way of using that file into Xcode? Thank you in advance.
0
0
1.2k
Jun ’21
Send local notification from Message Filter Extension
Hello guys, I'm implementing a message filter extension and I have an issue using notifications. The point is that I would like to trigger a notification for every message that comes into the junk folder. I tested the code for the notification in the MainViewController and it's working fine. Bellow is the code I'm using and I asked for user permissions in viewDidLoad() method.   func sendNotification(){         print("sendNotification.....")         //creating the notification content         let content = UNMutableNotificationContent()         //adding title, subtitle, body and badge         content.title = "Hey, test notification"         content.subtitle = "iOS Development is good"         content.body = "We are learning about iOS Local Notification"         content.badge = 1         //getting the notification trigger         //it will be called after 5 seconds         let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)         //getting the notification request         let request = UNNotificationRequest(identifier: "SimplifiedIOSNotification", content: content, trigger: trigger)         UNUserNotificationCenter.current().delegate = self         //adding the notification to notification center         UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)     } Is there a way of sending the notification when a message is filtered as junk to inform the user about that? Thank you devs.
0
0
553
Jun ’21
SMS and Call Spam Reporting extension is reporting the wrong number
I'm facing an issue with SMS and Call spam reporting extension for iOS 14.6. I've implemented the extension and when I select one or more messages and click the button to report the sender, the sender's phone number is getting reported, but with a string appended to its number. For example: The numbers that should be displayed are "orange" and "+40 753878811", but instead "filtered" is appended to every number. In this case, the numbers are not actually blocked and I am still able to receive messages and calls from them. Does anybody know why is this happening? Thank you devs!
1
0
900
Jun ’21