Error: Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around characterWie wird JSON Request in Swift unter Verwendung des unten erwähnten Codes serialisiert?
func FAQ(token: String){
let urlString = BaseURL + "faq?token=" + token
request(.GET, urlString).responseJSON(options: NSJSONReadingOptions.AllowFragments){(json) -> Void in
if json.result.error != nil{
NSNotificationCenter.defaultCenter().postNotificationName(NotifRequestError.FAQ.rawValue, object: json.result.error, userInfo: nil)
print(json.result.error)
return
}
let responseDict = NSMutableDictionary(dictionary: json.result.value as! NSDictionary)
print(responseDict)
NSNotificationCenter.defaultCenter().postNotificationName(NotifRequestSuccess.FAQ.rawValue, object: self, userInfo: ["data": responseDict])
}
}
Ihre json mutablecontainer nicht gültig ist – Gruntcakes
das ist der Grund, warum ich es hier gepostet haben, dieser Code funktioniert für andere apis, aber ich bin mit diesem Problem in wenigen api Anrufe konfrontiert. –
Wenn Sie wissen, dass der JSON ungültig ist, dann ist Ihr Titel völlig unpassend für die eigentliche Frage. – Gruntcakes