Image attachement not displayed on iOS

I’m trying to load an image from an attachment. I manage to get content, which seems to be valid but when I try to build an UIImage with it, it returns me nil.

Here is my code :

let rev = doc.currentRevision
if let attachements = rev?.attachments where attachements.count > 0 {
    let att = attachements.first!
    let photo = UIImage(data: att.content!)
    print ("Use couchbase attachements for image \(att.name) \(photo) \(att.content!)")
    return photo
}

For result I get a nil photo although the content is not nil :
Use couchbase attachements for image f6.1.1.ouv.indiana-temple…jpg nil <7b227479 7065223a 22427566 66657222 2c226461 7461223a 5b323535 2c323136 2c323535 2c323139 2c302c36 372c302c 362c342c 352c362c 352c342c 362c362c 352c362c 372c372c 362c382c 31302c31 362c3130 2c31302c 392c392c 31302c32 302c3134 2c31352c 31322c31 362c3233 2c32302c 32342c32 342c3233 2c32302c 32322c32 322c3236 2c32392c 33372c33 312c3236 2c32372c 33352c32 382c3232 2c32322c 33322c34 342c3332 2c33352c 33382c33 392c3431 2c34322c 34312c32 352c3331 2c34352c 34382c34 352c3430 2c34382c 33372c34 302c3431 2c34302c 3235352c 3231392c 302c3637 2c312c37 2c372c37 2c31302c 382c3130 2c31392c 31302c31 302c3139 2c34302c 32362c32 322c3236 2c34302c 34302c34 302c3430 2c34302c 34302c34 302c3430 2c34302c 34302c34 302c3430 2c34302c 34302c34 302c3430 2c34302c 34302c34 302c3430 [I can’t display the end but it’s continue and it’s really long]>

I just tried to open directly the blob file in a decoder site and I get something like this : {“type”:“Buffer”,“data”:[255,216,255,219,0,67,0,[continue with rgb data]]}

People used the same content on web and they didn’t have any problems. Is there something more I need to do for opening the file ? Or maybe something I should check in the content that is specific to iOS ?

That’s not JPEG image data, or actually any image format I know of. It looks like JSON to me. Something seems to have gotten mangled on the way into the document.

Ok thx that’s exactly that. Bug during export that made the blob file not in correct format.