Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7016745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:49:31+00:00 2026-05-27T22:49:31+00:00

I’m working on my first somewhat serious iOS app and I’m new to Xcode,

  • 0

I’m working on my first somewhat serious iOS app and I’m new to Xcode, iOS, and Objective-C. I’ve followed along with, and done a the first few assignments from Stanford’s iOS class on iTunesU. Aside from that I have no experience.

Anyways, I’m using an NSXMLParser to parse an XML file retrieved from the internet, and then I’m trying to create UGStory objects to represent some of the data and add them to an NSMutableArray.

EDIT: I’ve made some changes to the code and updated it here. Now I am sure there is a problem with my NSXMLParser functions. Now when the program executes I end up with 30 objects in the array, but when I inspect the array every object says “Out of Scope” and “Summary Unavailable”.

Also, this data is being used to populate a split view controller. Titles go in the masterview, links are used to fill the detailview. But after this executes there is only one thing in the master; “News @ Ultimate-Guitar.Com”

That is the first text enclosed by headers and at this point the header is yet to be encountered. Because of this I should have no UGStory objects so I’m confused by how this cell is being set. Also everything in the array is “Out of Scope” so where is the controller getting this data from? The controller does nothing more than create a UGFeedReader and send it the parseFeed message.

#import "UGFeedReader.h"

@implementation UGFeedReader

@synthesize currentTag = _currentTag;
@synthesize stories = _stories;
@synthesize read = _read;
@synthesize i = _i;

- (void)parseFeed
{
    NSURL* ugFeed = [NSURL URLWithString:@"http://www.ultimate-guitar.com/modules/rss/news.xml.php"];
     NSXMLParser* feedParser = [[NSXMLParser alloc]initWithContentsOfURL:ugFeed];
    _stories = [[NSMutableArray alloc] initWithCapacity:10];
    _i = 0;
    _read = NO;

    [feedParser setDelegate:self];
    [feedParser parse];
}

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict {

        if ([elementName isEqualToString:@"item"])
        {
            _read = YES;
            UGStory* temp = [[UGStory alloc] init];
            [_stories addObject:temp];
        }
    return;
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
    if (!_currentTag)
    {
        _currentTag = [[NSMutableString alloc] init];
    }
    [_currentTag appendString:string];
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName 
{
    if (_read == YES)
    {
        if ([elementName isEqualToString:@"title"]) {
            UGStory* temp = [_stories objectAtIndex:_i];
            temp.title = _currentTag;
        }
        if ([elementName isEqualToString:@"link"]) {
            UGStory* temp = [_stories objectAtIndex:_i];
            temp.url = [NSURL URLWithString:_currentTag];
            _read = NO;
            _i++;
        }
    }
        return;
}

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:49:31+00:00Added an answer on May 27, 2026 at 10:49 pm

    On this line:

    _stories = [_stories initWithCapacity:10];
    

    you probably meant:

    _stories = [[NSMutableArray alloc] initWithCapacity:10];
    

    On a nil array all the addObject: messages are ignored.

    You’re never nil‘ing _currentTag after you end an element.

    Add this code to the end of your didEndElement:

    [_currentTag release];
    _currentTag = nil;
    

    and it should work as you expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm making a simple page using Google Maps API 3. My first. One marker
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.