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
Do you have any problems with threads or async tasks during the mapping process? I get a request and map the json via
let json = JSON(responseObject)
var array: Array<AF_Poi> = Array()
for (index: String, subJson: JSON) in json {
let data = Mapper<AF_Poi>().map(subJson.dictionaryObject!)
array.append(data)
}
During the mapping process, the ui on the main thread is blocked. Do you have any ideas what to do about that?
The text was updated successfully, but these errors were encountered:
It is entirely possible that mapping is blocking the UI thread. ObjectMapper executes on the thread that it is called from so it is up to the developer make sure that it does not block the UI when executing.
You could do you mapping using Grand Central dispatch like this:
// Do Object mapping on a background queue
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)){
let parsedObject = Mapper<T>().map(JSONResponse)
dispatch_async(dispatch_get_main_queue()){
// use parsedObject on main thread
}
}
Do you have any problems with threads or async tasks during the mapping process? I get a request and map the json via
let json = JSON(responseObject)
var array: Array<AF_Poi> = Array()
for (index: String, subJson: JSON) in json {
let data = Mapper<AF_Poi>().map(subJson.dictionaryObject!)
array.append(data)
}
During the mapping process, the ui on the main thread is blocked. Do you have any ideas what to do about that?
The text was updated successfully, but these errors were encountered: