xcode with parse XML with image

zedsarrerie

New Member
I encode an xml parser to read images on the internet but i have a problem when I compile my file on xcodehe said: "Thread 1: SIGABRTHere is the code :View Controller.h : \[code\]#import <UIKit/UIKit.h>@interface ViewController : UIViewController<NSXMLParserDelegate> { IBOutlet UIImageView *imgView; NSMutableArray *photos;}@end\[/code\]viewController.m : \[code\]#import "ViewController.h"@implementation ViewController- (void)didReceiveMemoryWarning{ [super didReceiveMemoryWarning];}- (void)viewDidLoad{ [super viewDidLoad]; photos = [[NSMutableArray alloc] init]; NSXMLParser *photoParser = [[[NSXMLParser alloc] initWithContentsOfURL: [NSURL URLWithString:@"http://davylebeaugoss.free.fr/Sans%20titre.xml"]] autorelease]; [photoParser setDelegate:self]; [photoParser parse]; NSURL *imageURL = [NSURL URLWithString:[photos objectAtIndex:0]]; NSData *imageData = http://stackoverflow.com/questions/15456457/[NSData dataWithContentsOfURL:imageURL]; UIImage *image = [UIImage imageWithData:imageData]; [imgView setImage:image];}- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI: (NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{ if ( [elementName isEqualToString:@"photo"]) { [photos addObject:[attributeDict objectForKey:@"url"]];}}@end\[/code\]Thank you in advance!
 
Back
Top