You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all thanks for this wonderful library, I like it. 🙂
I just want to write an issue which I am facing, I work as an iOS developer and this issue occurs with Xcode-swift.
I am trying to upload media in bytes to API, let me explain it step by step:-
Created blank mappable object for e.g. let object = WorkOrderRequest(JSON: [:])
Added data to object for e.g. object.subJobID = 2 and other data accordingly.
Example:-
let attachment: WorkOrderAttachments?
attachment.MimeType = "ApplicationPDF"
attachment.FileName = "Name"
attachment.Media = Image object in bytes(Data)
assign that to 'object.WorkOrderAttachments = [attachment]'
Until here everything works fine, even I can extract each specific object(Media object as well).
Now when I try to upload it to API, I have to convert the object to JSON and pass it to the API. but somehow converting gets failed. I can see all the other objects in JSON except 'Media' somehow it gets lost or not converted.
Your help is much appreciated. Looking forward to hearing from you guys soon. TIA
Hello,
Greetings of the day!
First of all thanks for this wonderful library, I like it. 🙂
I just want to write an issue which I am facing, I work as an iOS developer and this issue occurs with Xcode-swift.
I am trying to upload media in bytes to API, let me explain it step by step:-
Example:-
let attachment: WorkOrderAttachments?
attachment.MimeType = "ApplicationPDF"
attachment.FileName = "Name"
attachment.Media = Image object in bytes(Data)
assign that to 'object.WorkOrderAttachments = [attachment]'
Until here everything works fine, even I can extract each specific object(Media object as well).
Your help is much appreciated. Looking forward to hearing from you guys soon. TIA
Your JSON dictionary:
[
"SubJobID": 2,
"WorkOrderAttachments": [
{
"MimeType": MimeType.ApplicationPDF,
"FileName": "WorkAuthorizationEmergency_08252021_1.pdf",
"Media": 3028bytes
}
],
"WoStatus": 1
]
Your model:
class NewWorkOrderRequest: NSObject, Mappable {
var subJobID : Int64?
var woStatus : Int64?
var workOrderAttachments : [WorkOrderAttachments]?
}
class WorkOrderAttachments: NSObject, Mappable {
}
What you did:
Data imported to object correctly, but while converting it to JSON, 'Media' object gets null and not passed to API.
For e.g.:- 'Object.toJSON()'
after converting, the result is like:-
[
"WoStatus": 1,
"SubJobID": 2,
"WorkOrderAttachments": [
{
"MimeType": "application/pdf",
"FileName": "WorkAuthorizationEmergency_08252021_1.pdf"
}
]
]
What you expected:
I expected something like:
Convert from Mappable object to JSON or JSONString is not working properly and data of object gets lost.
The text was updated successfully, but these errors were encountered: