Quantcast
Channel: Hydrate table using RSS feed data Objective C - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by 0x8badf00d for Hydrate table using RSS feed data Objective C

$
0
0
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.example.com/image.png"]]];

In the above line of code, NSURL URLWithString: is to use with file system URL like already downloaded image in your temp directory or plist file etc. Since you have passed a http URL it makes synchronous request blocking your thread until it finishes downloading image data. And if you are doing this on main thread then UI doesn't respond to touches until image gets downloaded.

Change it to make asynchronous call, i.e., download example.com/image.png asynchronously. You may refer to ASIHTTPRequest instance method startAsynchronous and then pass downloaded data to UIImage imageWithData:

To learn more about asynchronous network requests, watch session 208 WWDC 2010 Network Apps for iPhone OS Part-2


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>