Post

Replies

Boosts

Views

Activity

Comment on Keychain delete not work
let query = [             kSecClass: kSecClassGenericPassword,             kSecAttrService: "xx.xx.xx",             kSecReturnAttributes: true,             kSecAttrSynchronizable: true,             kSecReturnData: true           ] as CFDictionary           var result: AnyObject?           let status2 = SecItemCopyMatching(query, &result)           print("Operation finished with status: (status2)") Restult: Operation finished with status: 0
Topic: Privacy & Security SubTopic: General Tags:
Feb ’22
Comment on Keychain delete not work
I work with IOS 15, IpadOS 15, WatchOS 8.5. The application works by passing information for verification from the iPhone to the Watch via a keychain. But I need the event to delete data from the KeyChain, which is synchronized with Icloud. I use the application primarily on the iPhone, here does not work deleting or updating the Keys in the keychain. Thanks you for your help.
Topic: Privacy & Security SubTopic: General Tags:
Feb ’22
Comment on import pdf from url
there is all my code : import UIKit import MobileCoreServices import PDFKit import UniformTypeIdentifiers class DocumentUploadViewController: UIViewController,UINavigationControllerDelegate, UIDocumentPickerDelegate {     @IBOutlet weak var Admin_SW: UISwitch!     @IBOutlet weak var User_SW: UISwitch!     @IBOutlet weak var Editor_SW: UISwitch!     @IBOutlet weak var textfield: UITextField!     @IBOutlet weak var btnUpload: UIButton!         var dokumnetpdf = PDFDocument()          private var pdfname = ""     override func viewDidLoad() {         super.viewDidLoad()             }               @IBAction func TappedSelectPDF(_ sender: Any) {                 selectFiles()         if(textfield.text != ""){             btnUpload.isEnabled = false         }         else{             btnUpload.isEnabled = true         }         textfield.resignFirstResponder()     }          @IBAction func tappUpload(_ sender: Any) {         uploadToServer()     }          @IBAction func TappedFinish(_ sender: Any) {                  self.dismiss(animated: true, completion: nil)     }      private func uploadToServer(/sender: UITapGestureRecognizer/) {         let my_date = mydate()         let my_convert_date = myconvertdateNews(date: my_date)         let my_convert_time = myconverttime(date: my_date)     print("doc:(String(describing: dokumnetpdf))")         //let imageData: Data = NSData(contentsOfFile: odkaz.path) as Data                  //dokumnetpdf = PDFDocument(url: URL(fileURLWithPath: String(describing: odkaz)))!                  let imageData: Data = dokumnetpdf.dataRepresentation()!         let imageStr: String = imageData.base64EncodedString()         let alert = UIAlertController(title: "Loading", message: "Please wait...", preferredStyle: .alert)         present(alert, animated: true, completion: nil)                           var urlString: String = ""                     urlString = urlString + "id_item=(id_item)"                     urlString = urlString + "&filename=(pdfname)"                     urlString = urlString + "&description=(pdfname)"                     urlString = urlString + "&date=(my_convert_date)"                     urlString = urlString + "&time=(my_convert_time)"                     urlString = urlString + "&path=http://192.168.23.10/images/PDF_User/\(pdfname)"                     urlString = urlString + "&permitions=1"                     urlString = urlString + "&imageStr=" + imageStr          print(urlString)                         var request: URLRequest = URLRequest(url: URL(string: "http://192.168.23.10/oneuploafpdf.php")!)         request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")         request.httpMethod = "POST"         request.httpBody = urlString.data(using: .utf8)                    NSURLConnection.sendAsynchronousRequest(request, queue: .main, completionHandler: { (request, data, error) in               guard let data = data else {                 return             }               let responseString: String = String(data: data, encoding: .utf8)!             print("my_log = " + responseString)               alert.dismiss(animated: true, completion: {                   let messageAlert = UIAlertController(title: "Success", message: responseString, preferredStyle: .alert)                 messageAlert.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action: UIAlertAction!) in                     //                 }))                   self.present(messageAlert, animated: true, completion: nil)             })         })     }           func selectFiles() {         let types = UTType.pdf       let documentPickerController = UIDocumentPickerViewController(             forOpeningContentTypes: [types])                  documentPickerController.delegate = self         self.present(documentPickerController, animated: true, completion: nil)     }          func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {         guard let url = urls.first else {             print("Error: no url")             return         }         guard let dokument = PDFDocument(url: url) else {             print("Error: could not create PDFDocument from url: (url)")             return         }         guard url.startAccessingSecurityScopedResource() else {                 print("Error: could not access content of url: (url)")                 return             }             guard let dokument = PDFDocument(url: url) else {                 print("Error: could not create PDFDocument from url: (url)")                 return             }         dokumnetpdf = dokument        pdfname = url.lastPathComponent        print("PDF name: (pdfname)")        textfield.text = pdfname     }
Jan ’22