Post

Replies

Boosts

Views

Activity

How app will notified when user disabled the push notification from settings when app is not running?
Hi, When app is not running and user disable the push notification from app settings, how the app can identify this permission change? When user launch the app for next time the permission can be checked. But is there a way to identify without relaunching the app? Also how APNS is identifying this permission change or is this happening at device level?
1
0
897
Sep ’22
how to force WKWEBView or app to use WIFI over cellular
My app connects to an accessory via the hotspot provided by the accessory. This Wifi has no internet connection. Also app uses web WKWEBView to load UI So when the mobile data is on, even though the wifi is connected priority is for mobile Data. All the local request that is sent to the accessory is failing. Is there a way to force the WKWebView or app to use WIFI over cellular?
7
0
1.6k
Aug ’22
Need to prioritise Wifi over 4G programatically
Hi, My app connects to an accessory via the hotspot provided by the accessory. This Wifi has no internet connection. So when the mobile data is on, even though the wifi is connected priority is for mobile Data. All the local request that is sent to the accessory is failing. Is there a way to prioritise Wifi over mobile data ?. Is there a way to turn off mobile data programatically ?. How to handle this situation?
1
0
899
Aug ’22
Need to Submit an app with biometric and email verification sign In in App Store for review
Hi, I need to submit an app which uses biometric and email verification for sign in. What should be provided for the Sign-In Information when submitting this app for review? The review team cannot sign in to this account even though I provide a username since email and biometric verification are required. Will the review team create accounts and test them?
1
0
1.1k
Jul ’22
How to install and trust a 802.1x Radius certificate on the iOS device programmatically
Hi, In our project we have a device which will provide a secure access point(wifi and ethernet) and it is using a 802.1x Radius server authentication system. In order for the iOS devices to be network trusted in 802.1X, the root and intermediate CAs must be installed in iOS device. How can this be done programmatically in swift without sharing the user a link with the trusted certificate to the iOS devices and asking user to manually trust it from Certificate Trust Settings. Can I add the certificate to the list of trusted anchors using SecTrustSetAnchorCertificates(_: _:).
3
0
1.4k
Jul ’22
How to trust self signed certificate programmatically ?
My app is using a self signed certificate and we are planning to use the same in production. To avoid asking user to install the certificate manually, can I add the certificate to the list of trusted anchors using SecTrustSetAnchorCertificates(_: _:). Is this a correct approach ? Please find the code below:   func addAnchorToTrust(trust: SecTrust, certificate: SecCertificate) -> SecTrust {         let array: NSMutableArray = NSMutableArray()         array.add(certificate)         SecTrustSetAnchorCertificates(trust, array)         return trust     }     func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {         guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust, let serverTrust = challenge.protectionSpace.serverTrust else {             completionHandler(URLSession.AuthChallengeDisposition.cancelAuthenticationChallenge, nil)             return         }         let filePath = Bundle.main.path(forResource: "httpsPublicCertificate", ofType: "cer")         guard let file = filePath, let savedCertificateData = NSData(contentsOfFile: file), let rootCert = SecCertificateCreateWithData(kCFAllocatorDefault, savedCertificateData) else {             completionHandler(URLSession.AuthChallengeDisposition.cancelAuthenticationChallenge, nil)             return         }         let sslInput = addAnchorToTrust(trust: serverTrust, certificate: rootCert)         var result: SecTrustResultType = SecTrustResultType.unspecified         let error: OSStatus = SecTrustEvaluate(sslInput, &result)         if (error != 0){             completionHandler(URLSession.AuthChallengeDisposition.cancelAuthenticationChallenge, nil)             return         }         guard self.validate(trust: serverTrust, with: SecPolicyCreateBasicX509()), let serverCertificate = SecTrustGetCertificateAtIndex(serverTrust, 0)         else {             completionHandler(URLSession.AuthChallengeDisposition.cancelAuthenticationChallenge, nil)             return         }         let serverCertificateData = SecCertificateCopyData(serverCertificate)         let serverCertificateDataPtr = CFDataGetBytePtr(serverCertificateData);         let serverCertificateDataSize = CFDataGetLength(serverCertificateData);         let serverCertificateNSData = NSData(bytes: serverCertificateDataPtr, length: serverCertificateDataSize)         if serverCertificateNSData.isEqual(to: savedCertificateData as Data) {             completionHandler(URLSession.AuthChallengeDisposition.useCredential, URLCredential(trust:serverTrust))             return         }     }     private func validate(trust: SecTrust, with policy: SecPolicy) -> Bool {         let status = SecTrustSetPolicies(trust, policy)         guard status == errSecSuccess else { return false }         return SecTrustEvaluateWithError(trust, nil)     }
2
0
2.6k
Mar ’22
Not able to send short message using OutputStream.Write()
Hi, I am trying to implement SSL socket connection with an android device. I am able to receive the message from android device successfully. But while trying to write data , issue happens. This is my write function func write(message: String) {         let data = message.data(using: .utf8)!         data.withUnsafeBytes {             guard let pointer = $0.baseAddress?.assumingMemoryBound(to: UInt8.self)             else {                 print("Error")                 return             }             self.outputStream?.write(pointer, maxLength: data.count) } } If I send a small string, it is not received at android end. But when I send a large string, say count 30000 char. It will be received at android side. But first two characters will be lost. Below is my connect function: var inputStream: InputStream? var outputStream: OutputStream? var inputDelegate: StreamDelegate? var outputDelegate: StreamDelegate? func connect(host: String, port: Int) { Stream.getStreamsToHost(withName:host, port: 8443, inputStream: &inputStream, outputStream: &outputStream)         inputDelegate = self         outputDelegate = self         inputStream!.delegate = inputDelegate         outputStream!.delegate = outputDelegate         inputStream!.schedule(in:RunLoop.main, forMode: .default)         outputStream!.schedule(in:RunLoop.main, forMode: .default)      inputStream!.setProperty(kCFStreamSocketSecurityLevelNegotiatedSSL, forKey:  Stream.PropertyKey.socketSecurityLevelKey)   outputStream!.setProperty(kCFStreamSocketSecurityLevelNegotiatedSSL, forKey: Stream.PropertyKey.socketSecurityLevelKey)         let sslSettings : [NSString: Any] = [             NSString(format: kCFStreamSSLValidatesCertificateChain): kCFBooleanFalse,             NSString(format: kCFStreamSSLPeerName): kCFNull,             NSString(format: kCFStreamSSLIsServer): kCFBooleanFalse         ]         inputStream!.setProperty(sslSettings, forKey:  kCFStreamPropertySSLSettings as Stream.PropertyKey)         outputStream!.setProperty(sslSettings, forKey: kCFStreamPropertySSLSettings as Stream.PropertyKey)         inputStream!.open()         outputStream!.open()     }      Please help to debug the issue.
0
0
723
Oct ’21