Ошибка вызова Send API 400 Bad Request {message: '(# 100) Невозможно получить фото или видео с facebook url',

Это был бы мой подход. Вы можете добавить словарь сущностей из https://gist.github.com/mwaterfall/25b4a6a06dc3309d9555 упоминания Майкла Водопада.

extension String {
    func htmlDecoded()->String {

        guard (self != "") else { return self }

        var newStr = self

        let entities = [
            """    : "\"",
            "&"     : "&",
            "'"    : "'",
            "<"      : "<",
            ">"      : ">",
        ]

        for (name,value) in entities {
            newStr = newStr.stringByReplacingOccurrencesOfString(name, withString: value)
        }
        return newStr
    }
}

Используемые примеры:

let encoded = "this is so "good""
let decoded = encoded.htmlDecoded() // "this is so "good""

ИЛИ

let encoded = "this is so "good"".htmlDecoded() // "this is so "good""

0
задан user9964622 30 December 2018 в 17:56
поделиться