Hi friends,
My aim is to convert NSURL to NSData without any memory leaks... I searched lot and found more than one answer from the website but nothing works for me. Can anyone help me?
Below is the method I tried, but so far nothing works:
NSURL *url = [NSURL URLWithString:@"http://images.apple.com/main/rss/hotnews/hotnews.rss"];
NSData *data;
data = [NSData dataWithContentsOfURL:url];
NSError *error;
NSString* contents = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://images.apple.com/main/rss/hotnews/hotnews.rss"] encoding:NSUTF8StringEncoding error:nil];
NSData* xmlData = [contents dataUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [[NSURL alloc]initWithString:@"http://images.apple.com/main/rss/hotnews/hotnews.rss"];
NSData *data = [[NSData alloc]initWithContentsOfURL:url options:0 error:nil];
/*do something with data*/
[data release];
[url release];
Note:
When i change my url to http://www.wikipedia.org the code does not have any memory leak... Help me...
Thanks in advance.