それは、docにあります:
だから文字を終わる任意の行を追加することを避けるためにエンコードする際にまったくオプションを指定せず、無視することをデコードする際ignoreUnknownCharacters
を指定します行末の文字。
ステップ1:Hex String to Data is a separate StackOverflow question(!しかし、あなたがで始まるするには、Hex文字列を避ける必要があり、それはバイトの大きな無駄です)
ステップ2:base64のデータまたはBase64文字列へのデータ(いずれかを選択)
// By default, no line endings are inserted: https://developer.apple.com/reference/foundation/nsdata/1412739-base64encodeddata
let encodedAsData = data.base64EncodedData()
// By default, no line endings are inserted: https://developer.apple.com/reference/foundation/nsdata/1413546-base64encodedstring
let encodedAsString = data.base64EncodedString()
と16進数をBase 64に変換する方法は? – user3427013