小编Egl*_*yte的帖子

错误域=NSCocoaErrorDomain 代码=3840“字符 0 周围的值无效

嗨,我是 swift 的新手,我遇到了问题,我用 post 方法向服务器发出了一个请求,我得到了良好的 Json 响应,之后我又用 get 方法发出了另一个请求,但出现了这个错误。

错误: responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(Error Domain=NSCocoaErrorDomain Code=3840 “字符 0 周围的值无效。” UserInfo={NSDebugDescription=字符 0 周围的值无效。})

请求参数:

static func getInformationFromConfig(token: String, config: String, section : String, option: String) -> [String:Any] {

        let getInformationFromConfigparam: [String : Any] = ["jsonrpc": "2.0",
                                      "id": 1,
                                      "method": "call",
                                      "params": [ token, "uci", "get", [ "config": config, "section": section, "option": option]]
    ]

    return getInformationFromConfigparam
}



 public func device(token: String, loginCompletion: @escaping (Any) -> ()) {
    let deviceinfo = JsonRequests.getInformationFromConfig(token: token, config: "wireless", section: …
Run Code Online (Sandbox Code Playgroud)

xcode swift alamofire

2
推荐指数
1
解决办法
2万
查看次数

Swift 3谷歌地图在触摸时添加标记

我有谷歌地图标记的问题,我想把标记触摸,但我不知道如何处理它我尝试了一些方法,但它没有工作,没有任何反应,然后我触摸地图.新闻识别似乎有问题.

更新:

class MainMapController: UIViewController, CLLocationManagerDelegate {

@IBOutlet weak var viewMap: GMSMapView!
var makers: [GMSMarker] = []

var locationManager = CLLocationManager()

override func viewDidLoad() {
    super.viewDidLoad()


    initializeTheLocationManager()
    self.viewMap.isMyLocationEnabled = true
  let longPressRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPress))
  self.viewMap.addGestureRecognizer(longPressRecognizer)


}

  func handleLongPress(recognizer: UILongPressGestureRecognizer)
   {
if (recognizer.state == UIGestureRecognizerState.began)
{
  let longPressPoint = recognizer.location(in: self.viewMap);
  let coordinate = viewMap.projection.coordinate(for: longPressPoint )
  let marker = GMSMarker(position: coordinate)
  marker.opacity = 0.6
  marker.title = "Current Location"
  marker.snippet = ""
  marker.map = viewMap
  makers.append(marker)
    }
  } …
Run Code Online (Sandbox Code Playgroud)

google-maps google-maps-markers swift

2
推荐指数
1
解决办法
2274
查看次数