简体   繁体   中英

How should I archecture app to send data from server to iPhone using JSON as medium?

I have an iOS application that communicates with web server. For simplicity, the app has only one UITableView and cells only have one UIImageView with a label.

What are the best practices when sending the text data from the server to the device?

I have read that we can just ecode the UIImages from the server and pass it to the device together with the other text like so:

text: "someText"
image:"*&TFUNITGH(U*Y&^(*YG ---encodedData"

But is this the right approach to send them both together in JSON format? Is there a better way? Basically what i'm asking is, how best do i architecture my app so that I don't shoot my self in the foot when the project gets much larger and more complex? Any advice is much appreciated thanks.

As one commenter mentioned, the best approach would be:

  1. Server sends URL image links
  2. App loads the images asynchronously

This works well since the images are usually hosted on some image server for speed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM