Restkit performance with Afnetworking

Asked

Viewed 63 times

0

I built a restserver using the Slim Framework (PHP), connecting in a Mysql BD. Is on a dedicated server and moderate performance, IE the response is very fast.

But I made a test app on IOS where I consult this api and mount a table view with the result. No wifi goes fast, but in "3g" it takes 15 to 30 seconds to charge!

I’m using Restkit with Afnetworking. The api link is: http://api.guia-se.com.br/rafael/ (Can access p/ see result/ speed) It is normal to take all this time to mount Uitableview on a small json of these?

Does anyone know how to fix this?

1 answer

1

Everything indicates that it is a network problem but even for a 3G connection, it is a long time to get data.

I made a very simple benchmark, the minimum time for your service to respond was 511ms and the largest 2.11secs, IE, ta all within the normal.

Maybe it’s a problem of your data network, which has nothing to do with Afnetworking or Reskit.

UPDATE The hypostasis raised on the table is being updated outside the main thread makes sense.

First of all, to be sure, put a breakpoint at the point where your table updates and runs in debug mode, when the application stops at breakpoint, check if the stack is inside the main thread, see in the example below how it should appear.

Exemplo main thread

If it is not stopped in the main thread, use the solution below to execute the call that makes your table update.

dispatch_async(dispatch_get_main_queue(), ^{
  // execute aqui a chamada que faz sua tabela atualizar
});
  • I used to test other applications and they work normally. Of course, the network is slow (Brazil) but this specific application has this problem. In a group I was told that one possibility is that I’m updating Tableview outside the main thread. Since I’m a beginner, I didn’t understand it very well. You think that could be it?

  • It’s very likely that yes, to make sure, puts a breakpoint where your table view is updated. If the stack is not in the main thread, you can place the call that makes your table update into a block that changes it to the main thread, I will update my reply with an example.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.