Ey guys, I am having some problems adding NSURLs to an array and looping through them. Here are the relevant portions of my code:
RSS_ReaderAppDelegate.h:
@interface RSS_ReaderAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UINavigationController *navigationController;
NSDictionary *RSSFeeds;
NSMutableArray *RSSFeedURLs;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@property (nonatomic, retain) NSDictionary *RSSFeeds;
@property (nonatomic, retain) NSMutableArray *RSSFeedURLs;
RSS_ReaderAppDelegate.m:
@implementation RSS_ReaderAppDelegate
@synthesize window;
@synthesize navigationController;
@synthesize RSSFeeds, RSSFeedURLs;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
NSURL *url1 = [[NSURL alloc] initWithString:@"http://<some url>"]; //real URL has been hidden
NSURL *url2 = [[NSURL alloc] initWithString:@"http://<some other url>"]; //real URL has been hidden
[RSSFeedURLs initWithObjects: url1, url2, nil];
[url1 release];
[url2 release];
for (NSURL *url in RSSFeedURLs) { //jumps right over this for loop
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
XMLParser *parser = [[XMLParser alloc] init];
[xmlParser setDelegate:parser];
//Start parsing the XML file.
BOOL success = [xmlParser parse];
if(success)
NSLog(@"No Errors");
else
NSLog(@"Error(s) encountered");
}//for
// Add the navigation controller's view to the window and display.
[window addSubview:navigationController.view];
[window makeKeyAndVisible];
return YES;
}
So [RSSFeedURLs initWithObjects: url1, url2, nil];
doesn't seem to actually do anything as when I run the debugger and type "po RSSFeedsURLs" it reports: "Cannot access memory at address 0x0", and thus the for loop is never entered. I have no idea why this is so, can anyone shed some light on this situation for me? Thanks in advance.