[英]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. 我有一个与Web服务器通信的iOS应用程序。 For simplicity, the app has only one UITableView and cells only have one UIImageView with a label.
为简单起见,该应用程序只有一个UITableView,而单元格只有一个带有标签的UIImageView。
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: 我已经读到我们可以从服务器对UIImage进行编码,并将其与其他文本一起传递给设备,如下所示:
text: "someText"
image:"*&TFUNITGH(U*Y&^(*YG ---encodedData"
But is this the right approach to send them both together in JSON format? 但这是将两者以JSON格式一起发送的正确方法吗? 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: 正如一位评论者所述,最好的方法是:
This works well since the images are usually hosted on some image server for speed. 由于图像通常出于速度原因通常托管在某些图像服务器上,因此效果很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.