diff --git a/AgileWorks/AgileWorks/Login/View/LoginViewController.swift b/AgileWorks/AgileWorks/Login/View/LoginViewController.swift index efbfca4334ba141a3beda6c94fc27a58f1f0caed..62d21f32daa5e2b0219993293f964e483460ead1 100644 --- a/AgileWorks/AgileWorks/Login/View/LoginViewController.swift +++ b/AgileWorks/AgileWorks/Login/View/LoginViewController.swift @@ -333,8 +333,15 @@ extension LoginViewController: AVCaptureMetadataOutputObjectsDelegate { let loginQr = try JSONSerialization.jsonObject(with: jsonData) as! Dictionary print(loginQr["system_url"] as! String) // サーバーテキストボックス / コンテキストパステキストボックスに 値をセット - let temp = (loginQr["system_url"] as? String)?.replacingOccurrences(of: self.serverProtocol, with: "") - let serverInfo: [String] = temp!.components(separatedBy: "/") + let system = (loginQr["system_url"] as? String)?.replacingOccurrences(of: self.serverProtocol, with: "") + let mobile = (loginQr["mobile_system_url"] as? String)?.replacingOccurrences(of: self.serverProtocol, with: "") + var serverUrl = "" + if mobile != nil && !mobile!.isEmpty { + serverUrl = mobile! + } else { + serverUrl = system! + } + let serverInfo: [String] = serverUrl.components(separatedBy: "/") if !serverInfo.isEmpty { serverTextField.text = serverInfo[0] if serverInfo.count >= 2 {