Swift base64 decoding returns nil
问题 I am trying to decode a base64 string to an image in Swift using the following code: let decodedData=NSData(base64EncodedString: encodedImageData, options: NSDataBase64DecodingOptions.IgnoreUnknownCharacters) Unfortunately, the variable decodedData turns out to have a value of nil Debugging through the code, I verified that the variable encodedImageData is not nil and is the correct encoded image data(verified by using an online base64 to image converter). What could possibly be the reason