Your Base64 string is not valid. It must be padded with =
characters to have
a length that is a multiple of 4. In your case: "eyJlbWFp....MTM3fQ=="
.
With this padding, initWithBase64EncodedString
decodes the Base64 string correctly.
More Related Contents:
- Convert between UIImage and Base64 string
- Decoding JSON Web Tokens in Swift
- Decode Base-64 encoded PNG in an NSString
- how yo access item key in swift 4
- Who came first? IBAction or ViewDidLoad
- Creation of JSON array in swift 3
- Parse JSON with Objective-C
- How do I do base64 encoding on iOS?
- Convert UTF-8 encoded NSData to NSString
- Swift 3 URLSession.shared() Ambiguous reference to member ‘dataTask(with:completionHandler:) error (bug)
- Generate JSON string from NSDictionary in iOS
- How to parse JSON response from Alamofire API in Swift?
- Type ‘Any’ Has no Subscript Members in xcode 8 Swift 3 [duplicate]
- Convert array to JSON string in swift
- iOS: Serialize/Deserialize complex JSON generically from NSObject class
- Parsing nested Array of Dictionaries using Object Mapper
- JSON parsing swift, array has no value outside NSURLSession
- Decode base64URL to base64 — Swift
- How to parse JSON in iOS App
- iOS 5 JSON Parsing Results in Cocoa Error 3840
- How can I convert my device token (NSData) into an NSString?
- Simple and clean way to convert JSON string to Object in Swift
- -[NSNull length]: unrecognized selector sent to JSON objects
- Convert an iOS objective c object to a JSON string
- Checking a null value in Objective-C that has been returned from a JSON string
- How can I combine two Dictionary instances in Swift?
- POST request using application/x-www-form-urlencoded
- Swift String escaping when serializing to JSON using Codable
- How can you deserialize an escaped JSON string with NSJSONSerialization?
- Swift JSON error : Could not cast value of type ‘__NSDictionaryM’ to ‘NSArray’