[英]In which view controller delegate method do i request the api.?
I have been developing a weather application in iOS 8 . 我一直在开发iOS 8中的天气应用程序。 I need to display the parsed JSON when the view displays.
显示视图时,我需要显示已解析的JSON。 I am not sure in which delegate methods do i need to request the api.
我不确定我需要在哪些委托方法中请求api。 i know it should be requested in the background thread.
我知道应该在后台线程中请求它。 which are the delegate methods run on background thread?
在后台线程上运行哪些委托方法?
you can call your api in every where! 您可以在任何地方调用您的api! for example call in : AppDelegate or in initialize viewController .
例如在AppDelegate中或在初始化viewController中调用 。
but remember : your request is async so if the request going to fail or getting timed out you should handle it or notify toy first View Controller. 但请记住:您的请求是异步的,因此如果请求失败或超时,则应处理该请求或先通知玩具View Controller。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.